! function (e, t) {
    "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = e || self).TRTC = t()
}(this, (function () {
    function e(e, t) {
        var n = Object.keys(e);
        if (Object.getOwnPropertySymbols) {
            var r = Object.getOwnPropertySymbols(e);
            t && (r = r.filter((function (t) {
                return Object.getOwnPropertyDescriptor(e, t).enumerable
            }))), n.push.apply(n, r)
        }
        return n
    }

    function t(t) {
        for (var n = 1; n < arguments.length; n++) {
            var r = null != arguments[n] ? arguments[n] : {};
            n % 2 ? e(Object(r), !0).forEach((function (e) {
                c(t, e, r[e])
            })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : e(Object(r)).forEach((function (e) {
                Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e))
            }))
        }
        return t
    }

    function n(e) {
        return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
            return typeof e
        } : function (e) {
            return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
        })(e)
    }

    function r(e, t, n, r, i, a, o) {
        try {
            var s = e[a](o),
                c = s.value
        } catch (u) {
            return void n(u)
        }
        s.done ? t(c) : Promise.resolve(c).then(r, i)
    }

    function i(e) {
        return function () {
            var t = this,
                n = arguments;
            return new Promise((function (i, a) {
                var o = e.apply(t, n);

                function s(e) {
                    r(o, i, a, s, c, "next", e)
                }

                function c(e) {
                    r(o, i, a, s, c, "throw", e)
                }
                s(void 0)
            }))
        }
    }

    function a(e, t) {
        if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
    }

    function o(e, t) {
        for (var n = 0; n < t.length; n++) {
            var r = t[n];
            r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
        }
    }

    function s(e, t, n) {
        return t && o(e.prototype, t), n && o(e, n), e
    }

    function c(e, t, n) {
        return t in e ? Object.defineProperty(e, t, {
            value: n,
            enumerable: !0,
            configurable: !0,
            writable: !0
        }) : e[t] = n, e
    }

    function u(e, t) {
        if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
        e.prototype = Object.create(t && t.prototype, {
            constructor: {
                value: e,
                writable: !0,
                configurable: !0
            }
        }), t && l(e, t)
    }

    function d(e) {
        return (d = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
            return e.__proto__ || Object.getPrototypeOf(e)
        })(e)
    }

    function l(e, t) {
        return (l = Object.setPrototypeOf || function (e, t) {
            return e.__proto__ = t, e
        })(e, t)
    }

    function h() {
        if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
        if (Reflect.construct.sham) return !1;
        if ("function" == typeof Proxy) return !0;
        try {
            return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function () {}))), !0
        } catch (e) {
            return !1
        }
    }

    function p(e, t, n) {
        return (p = h() ? Reflect.construct : function (e, t, n) {
            var r = [null];
            r.push.apply(r, t);
            var i = new(Function.bind.apply(e, r));
            return n && l(i, n.prototype), i
        }).apply(null, arguments)
    }

    function f(e) {
        var t = "function" == typeof Map ? new Map : void 0;
        return (f = function (e) {
            if (null === e || (n = e, -1 === Function.toString.call(n).indexOf("[native code]"))) return e;
            var n;
            if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
            if (void 0 !== t) {
                if (t.has(e)) return t.get(e);
                t.set(e, r)
            }

            function r() {
                return p(e, arguments, d(this).constructor)
            }
            return r.prototype = Object.create(e.prototype, {
                constructor: {
                    value: r,
                    enumerable: !1,
                    writable: !0,
                    configurable: !0
                }
            }), l(r, e)
        })(e)
    }

    function m(e, t) {
        if (t && ("object" == typeof t || "function" == typeof t)) return t;
        if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
        return function (e) {
            if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
            return e
        }(e)
    }

    function _(e) {
        var t = h();
        return function () {
            var n, r = d(e);
            if (t) {
                var i = d(this).constructor;
                n = Reflect.construct(r, arguments, i)
            } else n = r.apply(this, arguments);
            return m(this, n)
        }
    }

    function v(e, t, n) {
        return (v = "undefined" != typeof Reflect && Reflect.get ? Reflect.get : function (e, t, n) {
            var r = function (e, t) {
                for (; !Object.prototype.hasOwnProperty.call(e, t) && null !== (e = d(e)););
                return e
            }(e, t);
            if (r) {
                var i = Object.getOwnPropertyDescriptor(r, t);
                return i.get ? i.get.call(n) : i.value
            }
        })(e, t, n || e)
    }

    function g(e, t) {
        return function (e) {
            if (Array.isArray(e)) return e
        }(e) || function (e, t) {
            var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
            if (null == n) return;
            var r, i, a = [],
                o = !0,
                s = !1;
            try {
                for (n = n.call(e); !(o = (r = n.next()).done) && (a.push(r.value), !t || a.length !== t); o = !0);
            } catch (c) {
                s = !0, i = c
            } finally {
                try {
                    o || null == n.return || n.return()
                } finally {
                    if (s) throw i
                }
            }
            return a
        }(e, t) || y(e, t) || function () {
            throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
        }()
    }

    function S(e) {
        return function (e) {
            if (Array.isArray(e)) return T(e)
        }(e) || function (e) {
            if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e)
        }(e) || y(e) || function () {
            throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
        }()
    }

    function y(e, t) {
        if (e) {
            if ("string" == typeof e) return T(e, t);
            var n = Object.prototype.toString.call(e).slice(8, -1);
            return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? T(e, t) : void 0
        }
    }

    function T(e, t) {
        (null == t || t > e.length) && (t = e.length);
        for (var n = 0, r = new Array(t); n < t; n++) r[n] = e[n];
        return r
    }

    function k(e, t) {
        var n = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
        if (!n) {
            if (Array.isArray(e) || (n = y(e)) || t && e && "number" == typeof e.length) {
                n && (e = n);
                var r = 0,
                    i = function () {};
                return {
                    s: i,
                    n: function () {
                        return r >= e.length ? {
                            done: !0
                        } : {
                            done: !1,
                            value: e[r++]
                        }
                    }, e: function (e) {
                        throw e
                    }, f: i
                }
            }
            throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
        }
        var a, o = !0,
            s = !1;
        return {
            s: function () {
                n = n.call(e)
            }, n: function () {
                var e = n.next();
                return o = e.done, e
            }, e: function (e) {
                s = !0, a = e
            }, f: function () {
                try {
                    o || null == n.return || n.return()
                } finally {
                    if (s) throw a
                }
            }
        }
    }

    function b(e, t, n, r, i) {
        var a = {};
        return Object.keys(r).forEach((function (e) {
            a[e] = r[e]
        })), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = !0), a = n.slice().reverse().reduce((function (n, r) {
            return r(e, t, n) || n
        }), a), i && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(i) : void 0, a.initializer = void 0), void 0 === a.initializer && (Object.defineProperty(e, t, a), a = null), a
    }
    var R = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};

    function E(e, t) {
        return e(t = {
            exports: {}
        }, t.exports), t.exports
    }
    var I, C, w = function (e) {
            return e && e.Math == Math && e
        },
        A = w("object" == typeof globalThis && globalThis) || w("object" == typeof window && window) || w("object" == typeof self && self) || w("object" == typeof R && R) || function () {
            return this
        }() || Function("return this")(),
        P = function (e) {
            try {
                return !!e()
            } catch (t) {
                return !0
            }
        },
        D = !P((function () {
            return 7 != Object.defineProperty({}, 1, {
                get: function () {
                    return 7
                }
            })[1]
        })),
        x = {}.propertyIsEnumerable,
        O = Object.getOwnPropertyDescriptor,
        N = {
            f: O && !x.call({
                1: 2
            }, 1) ? function (e) {
                var t = O(this, e);
                return !!t && t.enumerable
            } : x
        },
        M = function (e, t) {
            return {
                enumerable: !(1 & e),
                configurable: !(2 & e),
                writable: !(4 & e),
                value: t
            }
        },
        L = {}.toString,
        V = function (e) {
            return L.call(e).slice(8, -1)
        },
        U = "".split,
        F = P((function () {
            return !Object("z").propertyIsEnumerable(0)
        })) ? function (e) {
            return "String" == V(e) ? U.call(e, "") : Object(e)
        } : Object,
        j = function (e) {
            if (null == e) throw TypeError("Can't call method on " + e);
            return e
        },
        B = function (e) {
            return F(j(e))
        },
        H = function (e) {
            return "function" == typeof e
        },
        G = function (e) {
            return "object" == typeof e ? null !== e : H(e)
        },
        J = function (e) {
            return H(e) ? e : void 0
        },
        z = function (e, t) {
            return arguments.length < 2 ? J(A[e]) : A[e] && A[e][t]
        },
        W = z("navigator", "userAgent") || "",
        q = A.process,
        K = A.Deno,
        Q = q && q.versions || K && K.version,
        X = Q && Q.v8;
    X ? C = (I = X.split("."))[0] < 4 ? 1 : I[0] + I[1] : W && (!(I = W.match(/Edge\/(\d+)/)) || I[1] >= 74) && (I = W.match(/Chrome\/(\d+)/)) && (C = I[1]);
    var Y = C && +C,
        $ = !!Object.getOwnPropertySymbols && !P((function () {
            var e = Symbol();
            return !String(e) || !(Object(e) instanceof Symbol) || !Symbol.sham && Y && Y < 41
        })),
        Z = $ && !Symbol.sham && "symbol" == typeof Symbol.iterator,
        ee = Z ? function (e) {
            return "symbol" == typeof e
        } : function (e) {
            var t = z("Symbol");
            return H(t) && Object(e) instanceof t
        },
        te = function (e) {
            try {
                return String(e)
            } catch (t) {
                return "Object"
            }
        },
        ne = function (e) {
            if (H(e)) return e;
            throw TypeError(te(e) + " is not a function")
        },
        re = function (e, t) {
            var n = e[t];
            return null == n ? void 0 : ne(n)
        },
        ie = function (e, t) {
            try {
                Object.defineProperty(A, e, {
                    value: t,
                    configurable: !0,
                    writable: !0
                })
            } catch (n) {
                A[e] = t
            }
            return t
        },
        ae = A["__core-js_shared__"] || ie("__core-js_shared__", {}),
        oe = E((function (e) {
            (e.exports = function (e, t) {
                return ae[e] || (ae[e] = void 0 !== t ? t : {})
            })("versions", []).push({
                version: "3.18.2",
                mode: "global",
                copyright: "© 2021 Denis Pushkarev (zloirock.ru)"
            })
        })),
        se = function (e) {
            return Object(j(e))
        },
        ce = {}.hasOwnProperty,
        ue = Object.hasOwn || function (e, t) {
            return ce.call(se(e), t)
        },
        de = 0,
        le = Math.random(),
        he = function (e) {
            return "Symbol(" + String(void 0 === e ? "" : e) + ")_" + (++de + le).toString(36)
        },
        pe = oe("wks"),
        fe = A.Symbol,
        me = Z ? fe : fe && fe.withoutSetter || he,
        _e = function (e) {
            return ue(pe, e) && ($ || "string" == typeof pe[e]) || ($ && ue(fe, e) ? pe[e] = fe[e] : pe[e] = me("Symbol." + e)), pe[e]
        },
        ve = _e("toPrimitive"),
        ge = function (e, t) {
            if (!G(e) || ee(e)) return e;
            var n, r = re(e, ve);
            if (r) {
                if (void 0 === t && (t = "default"), n = r.call(e, t), !G(n) || ee(n)) return n;
                throw TypeError("Can't convert object to primitive value")
            }
            return void 0 === t && (t = "number"),
                function (e, t) {
                    var n, r;
                    if ("string" === t && H(n = e.toString) && !G(r = n.call(e))) return r;
                    if (H(n = e.valueOf) && !G(r = n.call(e))) return r;
                    if ("string" !== t && H(n = e.toString) && !G(r = n.call(e))) return r;
                    throw TypeError("Can't convert object to primitive value")
                }(e, t)
        },
        Se = function (e) {
            var t = ge(e, "string");
            return ee(t) ? t : String(t)
        },
        ye = A.document,
        Te = G(ye) && G(ye.createElement),
        ke = function (e) {
            return Te ? ye.createElement(e) : {}
        },
        be = !D && !P((function () {
            return 7 != Object.defineProperty(ke("div"), "a", {
                get: function () {
                    return 7
                }
            }).a
        })),
        Re = Object.getOwnPropertyDescriptor,
        Ee = {
            f: D ? Re : function (e, t) {
                if (e = B(e), t = Se(t), be) try {
                    return Re(e, t)
                } catch (n) {}
                if (ue(e, t)) return M(!N.f.call(e, t), e[t])
            }
        },
        Ie = function (e) {
            if (G(e)) return e;
            throw TypeError(String(e) + " is not an object")
        },
        Ce = Object.defineProperty,
        we = {
            f: D ? Ce : function (e, t, n) {
                if (Ie(e), t = Se(t), Ie(n), be) try {
                    return Ce(e, t, n)
                } catch (r) {}
                if ("get" in n || "set" in n) throw TypeError("Accessors not supported");
                return "value" in n && (e[t] = n.value), e
            }
        },
        Ae = D ? function (e, t, n) {
            return we.f(e, t, M(1, n))
        } : function (e, t, n) {
            return e[t] = n, e
        },
        Pe = Function.toString;
    H(ae.inspectSource) || (ae.inspectSource = function (e) {
        return Pe.call(e)
    });
    var De, xe, Oe, Ne = ae.inspectSource,
        Me = A.WeakMap,
        Le = H(Me) && /native code/.test(Ne(Me)),
        Ve = oe("keys"),
        Ue = function (e) {
            return Ve[e] || (Ve[e] = he(e))
        },
        Fe = {},
        je = A.WeakMap;
    if (Le || ae.state) {
        var Be = ae.state || (ae.state = new je),
            He = Be.get,
            Ge = Be.has,
            Je = Be.set;
        De = function (e, t) {
            if (Ge.call(Be, e)) throw new TypeError("Object already initialized");
            return t.facade = e, Je.call(Be, e, t), t
        }, xe = function (e) {
            return He.call(Be, e) || {}
        }, Oe = function (e) {
            return Ge.call(Be, e)
        }
    } else {
        var ze = Ue("state");
        Fe[ze] = !0, De = function (e, t) {
            if (ue(e, ze)) throw new TypeError("Object already initialized");
            return t.facade = e, Ae(e, ze, t), t
        }, xe = function (e) {
            return ue(e, ze) ? e[ze] : {}
        }, Oe = function (e) {
            return ue(e, ze)
        }
    }
    var We = {
            set: De,
            get: xe,
            has: Oe,
            enforce: function (e) {
                return Oe(e) ? xe(e) : De(e, {})
            }, getterFor: function (e) {
                return function (t) {
                    var n;
                    if (!G(t) || (n = xe(t)).type !== e) throw TypeError("Incompatible receiver, " + e + " required");
                    return n
                }
            }
        },
        qe = Function.prototype,
        Ke = D && Object.getOwnPropertyDescriptor,
        Qe = ue(qe, "name"),
        Xe = {
            EXISTS: Qe,
            PROPER: Qe && "something" === function () {}.name,
            CONFIGURABLE: Qe && (!D || D && Ke(qe, "name").configurable)
        },
        Ye = E((function (e) {
            var t = Xe.CONFIGURABLE,
                n = We.get,
                r = We.enforce,
                i = String(String).split("String");
            (e.exports = function (e, n, a, o) {
                var s, c = !!o && !!o.unsafe,
                    u = !!o && !!o.enumerable,
                    d = !!o && !!o.noTargetGet,
                    l = o && void 0 !== o.name ? o.name : n;
                H(a) && ("Symbol(" === String(l).slice(0, 7) && (l = "[" + String(l).replace(/^Symbol\(([^)]*)\)/, "$1") + "]"), (!ue(a, "name") || t && a.name !== l) && Ae(a, "name", l), (s = r(a)).source || (s.source = i.join("string" == typeof l ? l : ""))), e !== A ? (c ? !d && e[n] && (u = !0) : delete e[n], u ? e[n] = a : Ae(e, n, a)) : u ? e[n] = a : ie(n, a)
            })(Function.prototype, "toString", (function () {
                return H(this) && n(this).source || Ne(this)
            }))
        })),
        $e = Math.ceil,
        Ze = Math.floor,
        et = function (e) {
            var t = +e;
            return t != t || 0 === t ? 0 : (t > 0 ? Ze : $e)(t)
        },
        tt = Math.max,
        nt = Math.min,
        rt = function (e, t) {
            var n = et(e);
            return n < 0 ? tt(n + t, 0) : nt(n, t)
        },
        it = Math.min,
        at = function (e) {
            return e > 0 ? it(et(e), 9007199254740991) : 0
        },
        ot = function (e) {
            return at(e.length)
        },
        st = function (e) {
            return function (t, n, r) {
                var i, a = B(t),
                    o = ot(a),
                    s = rt(r, o);
                if (e && n != n) {
                    for (; o > s;)
                        if ((i = a[s++]) != i) return !0
                } else
                    for (; o > s; s++)
                        if ((e || s in a) && a[s] === n) return e || s || 0; return !e && -1
            }
        },
        ct = {
            includes: st(!0),
            indexOf: st(!1)
        },
        ut = ct.indexOf,
        dt = function (e, t) {
            var n, r = B(e),
                i = 0,
                a = [];
            for (n in r)!ue(Fe, n) && ue(r, n) && a.push(n);
            for (; t.length > i;) ue(r, n = t[i++]) && (~ut(a, n) || a.push(n));
            return a
        },
        lt = ["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf"],
        ht = lt.concat("length", "prototype"),
        pt = {
            f: Object.getOwnPropertyNames || function (e) {
                return dt(e, ht)
            }
        },
        ft = {
            f: Object.getOwnPropertySymbols
        },
        mt = z("Reflect", "ownKeys") || function (e) {
            var t = pt.f(Ie(e)),
                n = ft.f;
            return n ? t.concat(n(e)) : t
        },
        _t = function (e, t) {
            for (var n = mt(t), r = we.f, i = Ee.f, a = 0; a < n.length; a++) {
                var o = n[a];
                ue(e, o) || r(e, o, i(t, o))
            }
        },
        vt = /#|\.prototype\./,
        gt = function (e, t) {
            var n = yt[St(e)];
            return n == kt || n != Tt && (H(t) ? P(t) : !!t)
        },
        St = gt.normalize = function (e) {
            return String(e).replace(vt, ".").toLowerCase()
        },
        yt = gt.data = {},
        Tt = gt.NATIVE = "N",
        kt = gt.POLYFILL = "P",
        bt = gt,
        Rt = Ee.f,
        Et = function (e, t) {
            var n, r, i, a, o, s = e.target,
                c = e.global,
                u = e.stat;
            if (n = c ? A : u ? A[s] || ie(s, {}) : (A[s] || {}).prototype)
                for (r in t) {
                    if (a = t[r], i = e.noTargetGet ? (o = Rt(n, r)) && o.value : n[r], !bt(c ? r : s + (u ? "." : "#") + r, e.forced) && void 0 !== i) {
                        if (typeof a == typeof i) continue;
                        _t(a, i)
                    }(e.sham || i && i.sham) && Ae(a, "sham", !0), Ye(n, r, a, e)
                }
        },
        It = function (e, t, n) {
            if (ne(e), void 0 === t) return e;
            switch (n) {
            case 0:
                return function () {
                    return e.call(t)
                };
            case 1:
                return function (n) {
                    return e.call(t, n)
                };
            case 2:
                return function (n, r) {
                    return e.call(t, n, r)
                };
            case 3:
                return function (n, r, i) {
                    return e.call(t, n, r, i)
                }
            }
            return function () {
                return e.apply(t, arguments)
            }
        },
        Ct = Array.isArray || function (e) {
            return "Array" == V(e)
        },
        wt = {};
    wt[_e("toStringTag")] = "z";
    var At = "[object z]" === String(wt),
        Pt = _e("toStringTag"),
        Dt = "Arguments" == V(function () {
            return arguments
        }()),
        xt = At ? V : function (e) {
            var t, n, r;
            return void 0 === e ? "Undefined" : null === e ? "Null" : "string" == typeof (n = function (e, t) {
                try {
                    return e[t]
                } catch (n) {}
            }(t = Object(e), Pt)) ? n : Dt ? V(t) : "Object" == (r = V(t)) && H(t.callee) ? "Arguments" : r
        },
        Ot = [],
        Nt = z("Reflect", "construct"),
        Mt = /^\s*(?:class|function)\b/,
        Lt = Mt.exec,
        Vt = !Mt.exec((function () {})),
        Ut = function (e) {
            if (!H(e)) return !1;
            try {
                return Nt(Object, Ot, e), !0
            } catch (t) {
                return !1
            }
        },
        Ft = !Nt || P((function () {
            var e;
            return Ut(Ut.call) || !Ut(Object) || !Ut((function () {
                e = !0
            })) || e
        })) ? function (e) {
            if (!H(e)) return !1;
            switch (xt(e)) {
            case "AsyncFunction":
            case "GeneratorFunction":
            case "AsyncGeneratorFunction":
                return !1
            }
            return Vt || !!Lt.call(Mt, Ne(e))
        } : Ut,
        jt = _e("species"),
        Bt = function (e, t) {
            return new(function (e) {
                var t;
                return Ct(e) && (t = e.constructor, (Ft(t) && (t === Array || Ct(t.prototype)) || G(t) && null === (t = t[jt])) && (t = void 0)), void 0 === t ? Array : t
            }(e))(0 === t ? 0 : t)
        },
        Ht = [].push,
        Gt = function (e) {
            var t = 1 == e,
                n = 2 == e,
                r = 3 == e,
                i = 4 == e,
                a = 6 == e,
                o = 7 == e,
                s = 5 == e || a;
            return function (c, u, d, l) {
                for (var h, p, f = se(c), m = F(f), _ = It(u, d, 3), v = ot(m), g = 0, S = l || Bt, y = t ? S(c, v) : n || o ? S(c, 0) : void 0; v > g; g++)
                    if ((s || g in m) && (p = _(h = m[g], g, f), e))
                        if (t) y[g] = p;
                        else if (p) switch (e) {
                case 3:
                    return !0;
                case 5:
                    return h;
                case 6:
                    return g;
                case 2:
                    Ht.call(y, h)
                } else switch (e) {
                case 4:
                    return !1;
                case 7:
                    Ht.call(y, h)
                }
                return a ? -1 : r || i ? i : y
            }
        },
        Jt = {
            forEach: Gt(0),
            map: Gt(1),
            filter: Gt(2),
            some: Gt(3),
            every: Gt(4),
            find: Gt(5),
            findIndex: Gt(6),
            filterReject: Gt(7)
        },
        zt = _e("species"),
        Wt = function (e) {
            return Y >= 51 || !P((function () {
                var t = [];
                return (t.constructor = {})[zt] = function () {
                    return {
                        foo: 1
                    }
                }, 1 !== t[e](Boolean).foo
            }))
        },
        qt = Jt.map,
        Kt = Wt("map");
    Et({
        target: "Array",
        proto: !0,
        forced: !Kt
    }, {
        map: function (e) {
            return qt(this, e, arguments.length > 1 ? arguments[1] : void 0)
        }
    });
    var Qt = Jt.filter,
        Xt = Wt("filter");
    Et({
        target: "Array",
        proto: !0,
        forced: !Xt
    }, {
        filter: function (e) {
            return Qt(this, e, arguments.length > 1 ? arguments[1] : void 0)
        }
    });
    var Yt = Ee.f,
        $t = P((function () {
            Yt(1)
        }));
    Et({
        target: "Object",
        stat: !0,
        forced: !D || $t,
        sham: !D
    }, {
        getOwnPropertyDescriptor: function (e, t) {
            return Yt(B(e), t)
        }
    });
    E((function (e) {
        var t = function (e) {
            var t = Object.prototype,
                n = t.hasOwnProperty,
                r = "function" == typeof Symbol ? Symbol : {},
                i = r.iterator || "@@iterator",
                a = r.asyncIterator || "@@asyncIterator",
                o = r.toStringTag || "@@toStringTag";

            function s(e, t, n) {
                return Object.defineProperty(e, t, {
                    value: n,
                    enumerable: !0,
                    configurable: !0,
                    writable: !0
                }), e[t]
            }
            try {
                s({}, "")
            } catch (I) {
                s = function (e, t, n) {
                    return e[t] = n
                }
            }

            function c(e, t, n, r) {
                var i = t && t.prototype instanceof l ? t : l,
                    a = Object.create(i.prototype),
                    o = new b(r || []);
                return a._invoke = function (e, t, n) {
                    var r = "suspendedStart";
                    return function (i, a) {
                        if ("executing" === r) throw new Error("Generator is already running");
                        if ("completed" === r) {
                            if ("throw" === i) throw a;
                            return E()
                        }
                        for (n.method = i, n.arg = a;;) {
                            var o = n.delegate;
                            if (o) {
                                var s = y(o, n);
                                if (s) {
                                    if (s === d) continue;
                                    return s
                                }
                            }
                            if ("next" === n.method) n.sent = n._sent = n.arg;
                            else if ("throw" === n.method) {
                                if ("suspendedStart" === r) throw r = "completed", n.arg;
                                n.dispatchException(n.arg)
                            } else "return" === n.method && n.abrupt("return", n.arg);
                            r = "executing";
                            var c = u(e, t, n);
                            if ("normal" === c.type) {
                                if (r = n.done ? "completed" : "suspendedYield", c.arg === d) continue;
                                return {
                                    value: c.arg,
                                    done: n.done
                                }
                            }
                            "throw" === c.type && (r = "completed", n.method = "throw", n.arg = c.arg)
                        }
                    }
                }(e, n, o), a
            }

            function u(e, t, n) {
                try {
                    return {
                        type: "normal",
                        arg: e.call(t, n)
                    }
                } catch (I) {
                    return {
                        type: "throw",
                        arg: I
                    }
                }
            }
            e.wrap = c;
            var d = {};

            function l() {}

            function h() {}

            function p() {}
            var f = {};
            s(f, i, (function () {
                return this
            }));
            var m = Object.getPrototypeOf,
                _ = m && m(m(R([])));
            _ && _ !== t && n.call(_, i) && (f = _);
            var v = p.prototype = l.prototype = Object.create(f);

            function g(e) {
                ["next", "throw", "return"].forEach((function (t) {
                    s(e, t, (function (e) {
                        return this._invoke(t, e)
                    }))
                }))
            }

            function S(e, t) {
                var r;
                this._invoke = function (i, a) {
                    function o() {
                        return new t((function (r, o) {
                            ! function r(i, a, o, s) {
                                var c = u(e[i], e, a);
                                if ("throw" !== c.type) {
                                    var d = c.arg,
                                        l = d.value;
                                    return l && "object" == typeof l && n.call(l, "__await") ? t.resolve(l.__await).then((function (e) {
                                        r("next", e, o, s)
                                    }), (function (e) {
                                        r("throw", e, o, s)
                                    })) : t.resolve(l).then((function (e) {
                                        d.value = e, o(d)
                                    }), (function (e) {
                                        return r("throw", e, o, s)
                                    }))
                                }
                                s(c.arg)
                            }(i, a, r, o)
                        }))
                    }
                    return r = r ? r.then(o, o) : o()
                }
            }

            function y(e, t) {
                var n = e.iterator[t.method];
                if (void 0 === n) {
                    if (t.delegate = null, "throw" === t.method) {
                        if (e.iterator.return && (t.method = "return", t.arg = void 0, y(e, t), "throw" === t.method)) return d;
                        t.method = "throw", t.arg = new TypeError("The iterator does not provide a 'throw' method")
                    }
                    return d
                }
                var r = u(n, e.iterator, t.arg);
                if ("throw" === r.type) return t.method = "throw", t.arg = r.arg, t.delegate = null, d;
                var i = r.arg;
                return i ? i.done ? (t[e.resultName] = i.value, t.next = e.nextLoc, "return" !== t.method && (t.method = "next", t.arg = void 0), t.delegate = null, d) : i : (t.method = "throw", t.arg = new TypeError("iterator result is not an object"), t.delegate = null, d)
            }

            function T(e) {
                var t = {
                    tryLoc: e[0]
                };
                1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t)
            }

            function k(e) {
                var t = e.completion || {};
                t.type = "normal", delete t.arg, e.completion = t
            }

            function b(e) {
                this.tryEntries = [{
                    tryLoc: "root"
                }], e.forEach(T, this), this.reset(!0)
            }

            function R(e) {
                if (e) {
                    var t = e[i];
                    if (t) return t.call(e);
                    if ("function" == typeof e.next) return e;
                    if (!isNaN(e.length)) {
                        var r = -1,
                            a = function t() {
                                for (; ++r < e.length;)
                                    if (n.call(e, r)) return t.value = e[r], t.done = !1, t;
                                return t.value = void 0, t.done = !0, t
                            };
                        return a.next = a
                    }
                }
                return {
                    next: E
                }
            }

            function E() {
                return {
                    value: void 0,
                    done: !0
                }
            }
            return h.prototype = p, s(v, "constructor", p), s(p, "constructor", h), h.displayName = s(p, o, "GeneratorFunction"), e.isGeneratorFunction = function (e) {
                var t = "function" == typeof e && e.constructor;
                return !!t && (t === h || "GeneratorFunction" === (t.displayName || t.name))
            }, e.mark = function (e) {
                return Object.setPrototypeOf ? Object.setPrototypeOf(e, p) : (e.__proto__ = p, s(e, o, "GeneratorFunction")), e.prototype = Object.create(v), e
            }, e.awrap = function (e) {
                return {
                    __await: e
                }
            }, g(S.prototype), s(S.prototype, a, (function () {
                return this
            })), e.AsyncIterator = S, e.async = function (t, n, r, i, a) {
                void 0 === a && (a = Promise);
                var o = new S(c(t, n, r, i), a);
                return e.isGeneratorFunction(n) ? o : o.next().then((function (e) {
                    return e.done ? e.value : o.next()
                }))
            }, g(v), s(v, o, "Generator"), s(v, i, (function () {
                return this
            })), s(v, "toString", (function () {
                return "[object Generator]"
            })), e.keys = function (e) {
                var t = [];
                for (var n in e) t.push(n);
                return t.reverse(),
                    function n() {
                        for (; t.length;) {
                            var r = t.pop();
                            if (r in e) return n.value = r, n.done = !1, n
                        }
                        return n.done = !0, n
                    }
            }, e.values = R, b.prototype = {
                constructor: b,
                reset: function (e) {
                        if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = !1, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(k), !e)
                            for (var t in this) "t" === t.charAt(0) && n.call(this, t) && !isNaN(+t.slice(1)) && (this[t] = void 0)
                    }, stop: function () {
                        this.done = !0;
                        var e = this.tryEntries[0].completion;
                        if ("throw" === e.type) throw e.arg;
                        return this.rval
                    }, dispatchException: function (e) {
                        if (this.done) throw e;
                        var t = this;

                        function r(n, r) {
                            return o.type = "throw", o.arg = e, t.next = n, r && (t.method = "next", t.arg = void 0), !!r
                        }
                        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
                            var a = this.tryEntries[i],
                                o = a.completion;
                            if ("root" === a.tryLoc) return r("end");
                            if (a.tryLoc <= this.prev) {
                                var s = n.call(a, "catchLoc"),
                                    c = n.call(a, "finallyLoc");
                                if (s && c) {
                                    if (this.prev < a.catchLoc) return r(a.catchLoc, !0);
                                    if (this.prev < a.finallyLoc) return r(a.finallyLoc)
                                } else if (s) {
                                    if (this.prev < a.catchLoc) return r(a.catchLoc, !0)
                                } else {
                                    if (!c) throw new Error("try statement without catch or finally");
                                    if (this.prev < a.finallyLoc) return r(a.finallyLoc)
                                }
                            }
                        }
                    }, abrupt: function (e, t) {
                        for (var r = this.tryEntries.length - 1; r >= 0; --r) {
                            var i = this.tryEntries[r];
                            if (i.tryLoc <= this.prev && n.call(i, "finallyLoc") && this.prev < i.finallyLoc) {
                                var a = i;
                                break
                            }
                        }
                        a && ("break" === e || "continue" === e) && a.tryLoc <= t && t <= a.finallyLoc && (a = null);
                        var o = a ? a.completion : {};
                        return o.type = e, o.arg = t, a ? (this.method = "next", this.next = a.finallyLoc, d) : this.complete(o)
                    }, complete: function (e, t) {
                        if ("throw" === e.type) throw e.arg;
                        return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), d
                    }, finish: function (e) {
                        for (var t = this.tryEntries.length - 1; t >= 0; --t) {
                            var n = this.tryEntries[t];
                            if (n.finallyLoc === e) return this.complete(n.completion, n.afterLoc), k(n), d
                        }
                    },
                    catch: function (e) {
                        for (var t = this.tryEntries.length - 1; t >= 0; --t) {
                            var n = this.tryEntries[t];
                            if (n.tryLoc === e) {
                                var r = n.completion;
                                if ("throw" === r.type) {
                                    var i = r.arg;
                                    k(n)
                                }
                                return i
                            }
                        }
                        throw new Error("illegal catch attempt")
                    }, delegateYield: function (e, t, n) {
                        return this.delegate = {
                            iterator: R(e),
                            resultName: t,
                            nextLoc: n
                        }, "next" === this.method && (this.arg = void 0), d
                    }
            }, e
        }(e.exports);
        try {
            regeneratorRuntime = t
        } catch (n) {
            "object" == typeof globalThis ? globalThis.regeneratorRuntime = t : Function("r", "regeneratorRuntime = r")(t)
        }
    }));
    let Zt = !0,
        en = !0;

    function tn(e, t, n) {
        const r = e.match(t);
        return r && r.length >= n && parseInt(r[n], 10)
    }

    function nn(e, t, n) {
        if (!e.RTCPeerConnection) return;
        const r = e.RTCPeerConnection.prototype,
            i = r.addEventListener;
        r.addEventListener = function (e, r) {
            if (e !== t) return i.apply(this, arguments);
            const a = e => {
                const t = n(e);
                t && (r.handleEvent ? r.handleEvent(t) : r(t))
            };
            return this._eventMap = this._eventMap || {}, this._eventMap[t] || (this._eventMap[t] = new Map), this._eventMap[t].set(r, a), i.apply(this, [e, a])
        };
        const a = r.removeEventListener;
        r.removeEventListener = function (e, n) {
            if (e !== t || !this._eventMap || !this._eventMap[t]) return a.apply(this, arguments);
            if (!this._eventMap[t].has(n)) return a.apply(this, arguments);
            const r = this._eventMap[t].get(n);
            return this._eventMap[t].delete(n), 0 === this._eventMap[t].size && delete this._eventMap[t], 0 === Object.keys(this._eventMap).length && delete this._eventMap, a.apply(this, [e, r])
        }, Object.defineProperty(r, "on" + t, {
            get() {
                return this["_on" + t]
            }, set(e) {
                this["_on" + t] && (this.removeEventListener(t, this["_on" + t]), delete this["_on" + t]), e && this.addEventListener(t, this["_on" + t] = e)
            }, enumerable: !0, configurable: !0
        })
    }

    function rn(e) {
        return "boolean" != typeof e ? new Error("Argument type: " + typeof e + ". Please use a boolean.") : (Zt = e, e ? "adapter.js logging disabled" : "adapter.js logging enabled")
    }

    function an(e) {
        return "boolean" != typeof e ? new Error("Argument type: " + typeof e + ". Please use a boolean.") : (en = !e, "adapter.js deprecation warnings " + (e ? "disabled" : "enabled"))
    }

    function on() {
        if ("object" == typeof window) {
            if (Zt) return;
            "undefined" != typeof console && "function" == typeof console.log && console.log.apply(console, arguments)
        }
    }

    function sn(e, t) {
        en && console.warn(e + " is deprecated, please use " + t + " instead.")
    }

    function cn(e) {
        return "[object Object]" === Object.prototype.toString.call(e)
    }

    function un(e) {
        return cn(e) ? Object.keys(e).reduce((function (t, n) {
            const r = cn(e[n]),
                i = r ? un(e[n]) : e[n],
                a = r && !Object.keys(i).length;
            return void 0 === i || a ? t : Object.assign(t, {
                [n]: i
            })
        }), {}) : e
    }

    function dn(e, t, n) {
        const r = n ? "outbound-rtp" : "inbound-rtp",
            i = new Map;
        if (null === t) return i;
        const a = [];
        return e.forEach(e => {
            "track" === e.type && e.trackIdentifier === t.id && a.push(e)
        }), a.forEach(t => {
            e.forEach(n => {
                n.type === r && n.trackId === t.id && function e(t, n, r) {
                    n && !r.has(n.id) && (r.set(n.id, n), Object.keys(n).forEach(i => {
                        i.endsWith("Id") ? e(t, t.get(n[i]), r) : i.endsWith("Ids") && n[i].forEach(n => {
                            e(t, t.get(n), r)
                        })
                    }))
                }(e, n, i)
            })
        }), i
    }
    const ln = on;

    function hn(e, t) {
        const n = e && e.navigator;
        if (!n.mediaDevices) return;
        const r = function (e) {
                if ("object" != typeof e || e.mandatory || e.optional) return e;
                const t = {};
                return Object.keys(e).forEach(n => {
                    if ("require" === n || "advanced" === n || "mediaSource" === n) return;
                    const r = "object" == typeof e[n] ? e[n] : {
                        ideal: e[n]
                    };
                    void 0 !== r.exact && "number" == typeof r.exact && (r.min = r.max = r.exact);
                    const i = function (e, t) {
                        return e ? e + t.charAt(0).toUpperCase() + t.slice(1) : "deviceId" === t ? "sourceId" : t
                    };
                    if (void 0 !== r.ideal) {
                        t.optional = t.optional || [];
                        let e = {};
                        "number" == typeof r.ideal ? (e[i("min", n)] = r.ideal, t.optional.push(e), e = {}, e[i("max", n)] = r.ideal, t.optional.push(e)) : (e[i("", n)] = r.ideal, t.optional.push(e))
                    }
                    void 0 !== r.exact && "number" != typeof r.exact ? (t.mandatory = t.mandatory || {}, t.mandatory[i("", n)] = r.exact) : ["min", "max"].forEach(e => {
                        void 0 !== r[e] && (t.mandatory = t.mandatory || {}, t.mandatory[i(e, n)] = r[e])
                    })
                }), e.advanced && (t.optional = (t.optional || []).concat(e.advanced)), t
            },
            i = function (e, i) {
                if (t.version >= 61) return i(e);
                if ((e = JSON.parse(JSON.stringify(e))) && "object" == typeof e.audio) {
                    const t = function (e, t, n) {
                        t in e && !(n in e) && (e[n] = e[t], delete e[t])
                    };
                    t((e = JSON.parse(JSON.stringify(e))).audio, "autoGainControl", "googAutoGainControl"), t(e.audio, "noiseSuppression", "googNoiseSuppression"), e.audio = r(e.audio)
                }
                if (e && "object" == typeof e.video) {
                    let a = e.video.facingMode;
                    a = a && ("object" == typeof a ? a : {
                        ideal: a
                    });
                    const o = t.version < 66;
                    if (a && ("user" === a.exact || "environment" === a.exact || "user" === a.ideal || "environment" === a.ideal) && (!n.mediaDevices.getSupportedConstraints || !n.mediaDevices.getSupportedConstraints().facingMode || o)) {
                        let t;
                        if (delete e.video.facingMode, "environment" === a.exact || "environment" === a.ideal ? t = ["back", "rear"] : "user" !== a.exact && "user" !== a.ideal || (t = ["front"]), t) return n.mediaDevices.enumerateDevices().then(n => {
                            let o = (n = n.filter(e => "videoinput" === e.kind)).find(e => t.some(t => e.label.toLowerCase().includes(t)));
                            return !o && n.length && t.includes("back") && (o = n[n.length - 1]), o && (e.video.deviceId = a.exact ? {
                                exact: o.deviceId
                            } : {
                                ideal: o.deviceId
                            }), e.video = r(e.video), ln("chrome: " + JSON.stringify(e)), i(e)
                        })
                    }
                    e.video = r(e.video)
                }
                return ln("chrome: " + JSON.stringify(e)), i(e)
            },
            a = function (e) {
                return t.version >= 64 ? e : {
                    name: {
                        PermissionDeniedError: "NotAllowedError",
                        PermissionDismissedError: "NotAllowedError",
                        InvalidStateError: "NotAllowedError",
                        DevicesNotFoundError: "NotFoundError",
                        ConstraintNotSatisfiedError: "OverconstrainedError",
                        TrackStartError: "NotReadableError",
                        MediaDeviceFailedDueToShutdown: "NotAllowedError",
                        MediaDeviceKillSwitchOn: "NotAllowedError",
                        TabCaptureError: "AbortError",
                        ScreenCaptureError: "AbortError",
                        DeviceCaptureError: "AbortError"
                    }[e.name] || e.name,
                    message: e.message,
                    constraint: e.constraint || e.constraintName,
                    toString() {
                        return this.name + (this.message && ": ") + this.message
                    }
                }
            };
        if (n.getUserMedia = function (e, t, r) {
            i(e, e => {
                n.webkitGetUserMedia(e, t, e => {
                    r && r(a(e))
                })
            })
        }.bind(n), n.mediaDevices.getUserMedia) {
            const e = n.mediaDevices.getUserMedia.bind(n.mediaDevices);
            n.mediaDevices.getUserMedia = function (t) {
                return i(t, t => e(t).then(e => {
                    if (t.audio && !e.getAudioTracks().length || t.video && !e.getVideoTracks().length) throw e.getTracks().forEach(e => {
                        e.stop()
                    }), new DOMException("", "NotFoundError");
                    return e
                }, e => Promise.reject(a(e))))
            }
        }
    }

    function pn(e) {
        e.MediaStream = e.MediaStream || e.webkitMediaStream
    }

    function fn(e) {
        if ("object" == typeof e && e.RTCPeerConnection && !("ontrack" in e.RTCPeerConnection.prototype)) {
            Object.defineProperty(e.RTCPeerConnection.prototype, "ontrack", {
                get() {
                    return this._ontrack
                }, set(e) {
                    this._ontrack && this.removeEventListener("track", this._ontrack), this.addEventListener("track", this._ontrack = e)
                }, enumerable: !0, configurable: !0
            });
            const t = e.RTCPeerConnection.prototype.setRemoteDescription;
            e.RTCPeerConnection.prototype.setRemoteDescription = function () {
                return this._ontrackpoly || (this._ontrackpoly = t => {
                    t.stream.addEventListener("addtrack", n => {
                        let r;
                        r = e.RTCPeerConnection.prototype.getReceivers ? this.getReceivers().find(e => e.track && e.track.id === n.track.id) : {
                            track: n.track
                        };
                        const i = new Event("track");
                        i.track = n.track, i.receiver = r, i.transceiver = {
                            receiver: r
                        }, i.streams = [t.stream], this.dispatchEvent(i)
                    }), t.stream.getTracks().forEach(n => {
                        let r;
                        r = e.RTCPeerConnection.prototype.getReceivers ? this.getReceivers().find(e => e.track && e.track.id === n.id) : {
                            track: n
                        };
                        const i = new Event("track");
                        i.track = n, i.receiver = r, i.transceiver = {
                            receiver: r
                        }, i.streams = [t.stream], this.dispatchEvent(i)
                    })
                }, this.addEventListener("addstream", this._ontrackpoly)), t.apply(this, arguments)
            }
        } else nn(e, "track", e => (e.transceiver || Object.defineProperty(e, "transceiver", {
            value: {
                receiver: e.receiver
            }
        }), e))
    }

    function mn(e) {
        if ("object" == typeof e && e.RTCPeerConnection && !("getSenders" in e.RTCPeerConnection.prototype) && "createDTMFSender" in e.RTCPeerConnection.prototype) {
            const t = function (e, t) {
                return {
                    track: t,
                    get dtmf() {
                        return void 0 === this._dtmf && ("audio" === t.kind ? this._dtmf = e.createDTMFSender(t) : this._dtmf = null), this._dtmf
                    },
                    _pc: e
                }
            };
            if (!e.RTCPeerConnection.prototype.getSenders) {
                e.RTCPeerConnection.prototype.getSenders = function () {
                    return this._senders = this._senders || [], this._senders.slice()
                };
                const n = e.RTCPeerConnection.prototype.addTrack;
                e.RTCPeerConnection.prototype.addTrack = function (e, r) {
                    let i = n.apply(this, arguments);
                    return i || (i = t(this, e), this._senders.push(i)), i
                };
                const r = e.RTCPeerConnection.prototype.removeTrack;
                e.RTCPeerConnection.prototype.removeTrack = function (e) {
                    r.apply(this, arguments);
                    const t = this._senders.indexOf(e); - 1 !== t && this._senders.splice(t, 1)
                }
            }
            const n = e.RTCPeerConnection.prototype.addStream;
            e.RTCPeerConnection.prototype.addStream = function (e) {
                this._senders = this._senders || [], n.apply(this, [e]), e.getTracks().forEach(e => {
                    this._senders.push(t(this, e))
                })
            };
            const r = e.RTCPeerConnection.prototype.removeStream;
            e.RTCPeerConnection.prototype.removeStream = function (e) {
                this._senders = this._senders || [], r.apply(this, [e]), e.getTracks().forEach(e => {
                    const t = this._senders.find(t => t.track === e);
                    t && this._senders.splice(this._senders.indexOf(t), 1)
                })
            }
        } else if ("object" == typeof e && e.RTCPeerConnection && "getSenders" in e.RTCPeerConnection.prototype && "createDTMFSender" in e.RTCPeerConnection.prototype && e.RTCRtpSender && !("dtmf" in e.RTCRtpSender.prototype)) {
            const t = e.RTCPeerConnection.prototype.getSenders;
            e.RTCPeerConnection.prototype.getSenders = function () {
                const e = t.apply(this, []);
                return e.forEach(e => e._pc = this), e
            }, Object.defineProperty(e.RTCRtpSender.prototype, "dtmf", {
                get() {
                    return void 0 === this._dtmf && ("audio" === this.track.kind ? this._dtmf = this._pc.createDTMFSender(this.track) : this._dtmf = null), this._dtmf
                }
            })
        }
    }

    function _n(e) {
        if (!e.RTCPeerConnection) return;
        const t = e.RTCPeerConnection.prototype.getStats;
        e.RTCPeerConnection.prototype.getStats = function () {
            const [e, n, r] = arguments;
            if (arguments.length > 0 && "function" == typeof e) return t.apply(this, arguments);
            if (0 === t.length && (0 === arguments.length || "function" != typeof e)) return t.apply(this, []);
            const i = function (e) {
                    const t = {};
                    return e.result().forEach(e => {
                        const n = {
                            id: e.id,
                            timestamp: e.timestamp,
                            type: {
                                localcandidate: "local-candidate",
                                remotecandidate: "remote-candidate"
                            }[e.type] || e.type
                        };
                        e.names().forEach(t => {
                            n[t] = e.stat(t)
                        }), t[n.id] = n
                    }), t
                },
                a = function (e) {
                    return new Map(Object.keys(e).map(t => [t, e[t]]))
                };
            if (arguments.length >= 2) {
                const r = function (e) {
                    n(a(i(e)))
                };
                return t.apply(this, [r, e])
            }
            return new Promise((e, n) => {
                t.apply(this, [
                    function (t) {
                        e(a(i(t)))
                    },
                    n
                ])
            }).then(n, r)
        }
    }

    function vn(e) {
        if (!("object" == typeof e && e.RTCPeerConnection && e.RTCRtpSender && e.RTCRtpReceiver)) return;
        if (!("getStats" in e.RTCRtpSender.prototype)) {
            const t = e.RTCPeerConnection.prototype.getSenders;
            t && (e.RTCPeerConnection.prototype.getSenders = function () {
                const e = t.apply(this, []);
                return e.forEach(e => e._pc = this), e
            });
            const n = e.RTCPeerConnection.prototype.addTrack;
            n && (e.RTCPeerConnection.prototype.addTrack = function () {
                const e = n.apply(this, arguments);
                return e._pc = this, e
            }), e.RTCRtpSender.prototype.getStats = function () {
                const e = this;
                return this._pc.getStats().then(t => dn(t, e.track, !0))
            }
        }
        if (!("getStats" in e.RTCRtpReceiver.prototype)) {
            const t = e.RTCPeerConnection.prototype.getReceivers;
            t && (e.RTCPeerConnection.prototype.getReceivers = function () {
                const e = t.apply(this, []);
                return e.forEach(e => e._pc = this), e
            }), nn(e, "track", e => (e.receiver._pc = e.srcElement, e)), e.RTCRtpReceiver.prototype.getStats = function () {
                const e = this;
                return this._pc.getStats().then(t => dn(t, e.track, !1))
            }
        }
        if (!("getStats" in e.RTCRtpSender.prototype) || !("getStats" in e.RTCRtpReceiver.prototype)) return;
        const t = e.RTCPeerConnection.prototype.getStats;
        e.RTCPeerConnection.prototype.getStats = function () {
            if (arguments.length > 0 && arguments[0] instanceof e.MediaStreamTrack) {
                const e = arguments[0];
                let t, n, r;
                return this.getSenders().forEach(n => {
                    n.track === e && (t ? r = !0 : t = n)
                }), this.getReceivers().forEach(t => (t.track === e && (n ? r = !0 : n = t), t.track === e)), r || t && n ? Promise.reject(new DOMException("There are more than one sender or receiver for the track.", "InvalidAccessError")) : t ? t.getStats() : n ? n.getStats() : Promise.reject(new DOMException("There is no sender or receiver for the track.", "InvalidAccessError"))
            }
            return t.apply(this, arguments)
        }
    }

    function gn(e) {
        e.RTCPeerConnection.prototype.getLocalStreams = function () {
            return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, Object.keys(this._shimmedLocalStreams).map(e => this._shimmedLocalStreams[e][0])
        };
        const t = e.RTCPeerConnection.prototype.addTrack;
        e.RTCPeerConnection.prototype.addTrack = function (e, n) {
            if (!n) return t.apply(this, arguments);
            this._shimmedLocalStreams = this._shimmedLocalStreams || {};
            const r = t.apply(this, arguments);
            return this._shimmedLocalStreams[n.id] ? -1 === this._shimmedLocalStreams[n.id].indexOf(r) && this._shimmedLocalStreams[n.id].push(r) : this._shimmedLocalStreams[n.id] = [n, r], r
        };
        const n = e.RTCPeerConnection.prototype.addStream;
        e.RTCPeerConnection.prototype.addStream = function (e) {
            this._shimmedLocalStreams = this._shimmedLocalStreams || {}, e.getTracks().forEach(e => {
                if (this.getSenders().find(t => t.track === e)) throw new DOMException("Track already exists.", "InvalidAccessError")
            });
            const t = this.getSenders();
            n.apply(this, arguments);
            const r = this.getSenders().filter(e => -1 === t.indexOf(e));
            this._shimmedLocalStreams[e.id] = [e].concat(r)
        };
        const r = e.RTCPeerConnection.prototype.removeStream;
        e.RTCPeerConnection.prototype.removeStream = function (e) {
            return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, delete this._shimmedLocalStreams[e.id], r.apply(this, arguments)
        };
        const i = e.RTCPeerConnection.prototype.removeTrack;
        e.RTCPeerConnection.prototype.removeTrack = function (e) {
            return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, e && Object.keys(this._shimmedLocalStreams).forEach(t => {
                const n = this._shimmedLocalStreams[t].indexOf(e); - 1 !== n && this._shimmedLocalStreams[t].splice(n, 1), 1 === this._shimmedLocalStreams[t].length && delete this._shimmedLocalStreams[t]
            }), i.apply(this, arguments)
        }
    }

    function Sn(e, t) {
        if (!e.RTCPeerConnection) return;
        if (e.RTCPeerConnection.prototype.addTrack && t.version >= 65) return gn(e);
        const n = e.RTCPeerConnection.prototype.getLocalStreams;
        e.RTCPeerConnection.prototype.getLocalStreams = function () {
            const e = n.apply(this);
            return this._reverseStreams = this._reverseStreams || {}, e.map(e => this._reverseStreams[e.id])
        };
        const r = e.RTCPeerConnection.prototype.addStream;
        e.RTCPeerConnection.prototype.addStream = function (t) {
            if (this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, t.getTracks().forEach(e => {
                if (this.getSenders().find(t => t.track === e)) throw new DOMException("Track already exists.", "InvalidAccessError")
            }), !this._reverseStreams[t.id]) {
                const n = new e.MediaStream(t.getTracks());
                this._streams[t.id] = n, this._reverseStreams[n.id] = t, t = n
            }
            r.apply(this, [t])
        };
        const i = e.RTCPeerConnection.prototype.removeStream;

        function a(e, t) {
            let n = t.sdp;
            return Object.keys(e._reverseStreams || []).forEach(t => {
                const r = e._reverseStreams[t],
                    i = e._streams[r.id];
                n = n.replace(new RegExp(i.id, "g"), r.id)
            }), new RTCSessionDescription({
                type: t.type,
                sdp: n
            })
        }

        function o(e, t) {
            let n = t.sdp;
            return Object.keys(e._reverseStreams || []).forEach(t => {
                const r = e._reverseStreams[t],
                    i = e._streams[r.id];
                n = n.replace(new RegExp(r.id, "g"), i.id)
            }), new RTCSessionDescription({
                type: t.type,
                sdp: n
            })
        }
        e.RTCPeerConnection.prototype.removeStream = function (e) {
            this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, i.apply(this, [this._streams[e.id] || e]), delete this._reverseStreams[this._streams[e.id] ? this._streams[e.id].id : e.id], delete this._streams[e.id]
        }, e.RTCPeerConnection.prototype.addTrack = function (t, n) {
            if ("closed" === this.signalingState) throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.", "InvalidStateError");
            const r = [].slice.call(arguments, 1);
            if (1 !== r.length || !r[0].getTracks().find(e => e === t)) throw new DOMException("The adapter.js addTrack polyfill only supports a single  stream which is associated with the specified track.", "NotSupportedError");
            const i = this.getSenders().find(e => e.track === t);
            if (i) throw new DOMException("Track already exists.", "InvalidAccessError");
            this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {};
            const a = this._streams[n.id];
            if (a) a.addTrack(t), Promise.resolve().then(() => {
                this.dispatchEvent(new Event("negotiationneeded"))
            });
            else {
                const r = new e.MediaStream([t]);
                this._streams[n.id] = r, this._reverseStreams[r.id] = n, this.addStream(r)
            }
            return this.getSenders().find(e => e.track === t)
        }, ["createOffer", "createAnswer"].forEach((function (t) {
            const n = e.RTCPeerConnection.prototype[t],
                r = {
                    [t]() {
                        const e = arguments;
                        return arguments.length && "function" == typeof arguments[0] ? n.apply(this, [t => {
                                const n = a(this, t);
                                e[0].apply(null, [n])
                            },
                            t => {
                                e[1] && e[1].apply(null, t)
                            },
                            arguments[2]
                        ]) : n.apply(this, arguments).then(e => a(this, e))
                    }
                };
            e.RTCPeerConnection.prototype[t] = r[t]
        }));
        const s = e.RTCPeerConnection.prototype.setLocalDescription;
        e.RTCPeerConnection.prototype.setLocalDescription = function () {
            return arguments.length && arguments[0].type ? (arguments[0] = o(this, arguments[0]), s.apply(this, arguments)) : s.apply(this, arguments)
        };
        const c = Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype, "localDescription");
        Object.defineProperty(e.RTCPeerConnection.prototype, "localDescription", {
            get() {
                const e = c.get.apply(this);
                return "" === e.type ? e : a(this, e)
            }
        }), e.RTCPeerConnection.prototype.removeTrack = function (e) {
            if ("closed" === this.signalingState) throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.", "InvalidStateError");
            if (!e._pc) throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.", "TypeError");
            if (!(e._pc === this)) throw new DOMException("Sender was not created by this connection.", "InvalidAccessError");
            let t;
            this._streams = this._streams || {}, Object.keys(this._streams).forEach(n => {
                this._streams[n].getTracks().find(t => e.track === t) && (t = this._streams[n])
            }), t && (1 === t.getTracks().length ? this.removeStream(this._reverseStreams[t.id]) : t.removeTrack(e.track), this.dispatchEvent(new Event("negotiationneeded")))
        }
    }

    function yn(e, t) {
        !e.RTCPeerConnection && e.webkitRTCPeerConnection && (e.RTCPeerConnection = e.webkitRTCPeerConnection), e.RTCPeerConnection && t.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach((function (t) {
            const n = e.RTCPeerConnection.prototype[t],
                r = {
                    [t]() {
                        return arguments[0] = new("addIceCandidate" === t ? e.RTCIceCandidate : e.RTCSessionDescription)(arguments[0]), n.apply(this, arguments)
                    }
                };
            e.RTCPeerConnection.prototype[t] = r[t]
        }))
    }

    function Tn(e, t) {
        nn(e, "negotiationneeded", e => {
            const n = e.target;
            if (!(t.version < 72 || n.getConfiguration && "plan-b" === n.getConfiguration().sdpSemantics) || "stable" === n.signalingState) return e
        })
    }
    var kn = Object.freeze({
        __proto__: null,
        shimMediaStream: pn,
        shimOnTrack: fn,
        shimGetSendersWithDtmf: mn,
        shimGetStats: _n,
        shimSenderReceiverGetStats: vn,
        shimAddTrackRemoveTrackWithNative: gn,
        shimAddTrackRemoveTrack: Sn,
        shimPeerConnection: yn,
        fixNegotiationNeeded: Tn,
        shimGetUserMedia: hn,
        shimGetDisplayMedia: function (e, t) {
            e.navigator.mediaDevices && "getDisplayMedia" in e.navigator.mediaDevices || e.navigator.mediaDevices && ("function" == typeof t ? e.navigator.mediaDevices.getDisplayMedia = function (n) {
                return t(n).then(t => {
                    const r = n.video && n.video.width,
                        i = n.video && n.video.height,
                        a = n.video && n.video.frameRate;
                    return n.video = {
                        mandatory: {
                            chromeMediaSource: "desktop",
                            chromeMediaSourceId: t,
                            maxFrameRate: a || 3
                        }
                    }, r && (n.video.mandatory.maxWidth = r), i && (n.video.mandatory.maxHeight = i), e.navigator.mediaDevices.getUserMedia(n)
                })
            } : console.error("shimGetDisplayMedia: getSourceId argument is not a function"))
        }
    });
    var bn = E((function (e) {
        var t = {
            generateIdentifier: function () {
                return Math.random().toString(36).substr(2, 10)
            }
        };
        t.localCName = t.generateIdentifier(), t.splitLines = function (e) {
            return e.trim().split("\n").map((function (e) {
                return e.trim()
            }))
        }, t.splitSections = function (e) {
            return e.split("\nm=").map((function (e, t) {
                return (t > 0 ? "m=" + e : e).trim() + "\r\n"
            }))
        }, t.getDescription = function (e) {
            var n = t.splitSections(e);
            return n && n[0]
        }, t.getMediaSections = function (e) {
            var n = t.splitSections(e);
            return n.shift(), n
        }, t.matchPrefix = function (e, n) {
            return t.splitLines(e).filter((function (e) {
                return 0 === e.indexOf(n)
            }))
        }, t.parseCandidate = function (e) {
            for (var t, n = {
                foundation: (t = 0 === e.indexOf("a=candidate:") ? e.substring(12).split(" ") : e.substring(10).split(" "))[0],
                component: parseInt(t[1], 10),
                protocol: t[2].toLowerCase(),
                priority: parseInt(t[3], 10),
                ip: t[4],
                address: t[4],
                port: parseInt(t[5], 10),
                type: t[7]
            }, r = 8; r < t.length; r += 2) switch (t[r]) {
            case "raddr":
                n.relatedAddress = t[r + 1];
                break;
            case "rport":
                n.relatedPort = parseInt(t[r + 1], 10);
                break;
            case "tcptype":
                n.tcpType = t[r + 1];
                break;
            case "ufrag":
                n.ufrag = t[r + 1], n.usernameFragment = t[r + 1];
                break;
            default:
                n[t[r]] = t[r + 1]
            }
            return n
        }, t.writeCandidate = function (e) {
            var t = [];
            t.push(e.foundation), t.push(e.component), t.push(e.protocol.toUpperCase()), t.push(e.priority), t.push(e.address || e.ip), t.push(e.port);
            var n = e.type;
            return t.push("typ"), t.push(n), "host" !== n && e.relatedAddress && e.relatedPort && (t.push("raddr"), t.push(e.relatedAddress), t.push("rport"), t.push(e.relatedPort)), e.tcpType && "tcp" === e.protocol.toLowerCase() && (t.push("tcptype"), t.push(e.tcpType)), (e.usernameFragment || e.ufrag) && (t.push("ufrag"), t.push(e.usernameFragment || e.ufrag)), "candidate:" + t.join(" ")
        }, t.parseIceOptions = function (e) {
            return e.substr(14).split(" ")
        }, t.parseRtpMap = function (e) {
            var t = e.substr(9).split(" "),
                n = {
                    payloadType: parseInt(t.shift(), 10)
                };
            return t = t[0].split("/"), n.name = t[0], n.clockRate = parseInt(t[1], 10), n.channels = 3 === t.length ? parseInt(t[2], 10) : 1, n.numChannels = n.channels, n
        }, t.writeRtpMap = function (e) {
            var t = e.payloadType;
            void 0 !== e.preferredPayloadType && (t = e.preferredPayloadType);
            var n = e.channels || e.numChannels || 1;
            return "a=rtpmap:" + t + " " + e.name + "/" + e.clockRate + (1 !== n ? "/" + n : "") + "\r\n"
        }, t.parseExtmap = function (e) {
            var t = e.substr(9).split(" ");
            return {
                id: parseInt(t[0], 10),
                direction: t[0].indexOf("/") > 0 ? t[0].split("/")[1] : "sendrecv",
                uri: t[1]
            }
        }, t.writeExtmap = function (e) {
            return "a=extmap:" + (e.id || e.preferredId) + (e.direction && "sendrecv" !== e.direction ? "/" + e.direction : "") + " " + e.uri + "\r\n"
        }, t.parseFmtp = function (e) {
            for (var t, n = {}, r = e.substr(e.indexOf(" ") + 1).split(";"), i = 0; i < r.length; i++) n[(t = r[i].trim().split("="))[0].trim()] = t[1];
            return n
        }, t.writeFmtp = function (e) {
            var t = "",
                n = e.payloadType;
            if (void 0 !== e.preferredPayloadType && (n = e.preferredPayloadType), e.parameters && Object.keys(e.parameters).length) {
                var r = [];
                Object.keys(e.parameters).forEach((function (t) {
                    e.parameters[t] ? r.push(t + "=" + e.parameters[t]) : r.push(t)
                })), t += "a=fmtp:" + n + " " + r.join(";") + "\r\n"
            }
            return t
        }, t.parseRtcpFb = function (e) {
            var t = e.substr(e.indexOf(" ") + 1).split(" ");
            return {
                type: t.shift(),
                parameter: t.join(" ")
            }
        }, t.writeRtcpFb = function (e) {
            var t = "",
                n = e.payloadType;
            return void 0 !== e.preferredPayloadType && (n = e.preferredPayloadType), e.rtcpFeedback && e.rtcpFeedback.length && e.rtcpFeedback.forEach((function (e) {
                t += "a=rtcp-fb:" + n + " " + e.type + (e.parameter && e.parameter.length ? " " + e.parameter : "") + "\r\n"
            })), t
        }, t.parseSsrcMedia = function (e) {
            var t = e.indexOf(" "),
                n = {
                    ssrc: parseInt(e.substr(7, t - 7), 10)
                },
                r = e.indexOf(":", t);
            return r > -1 ? (n.attribute = e.substr(t + 1, r - t - 1), n.value = e.substr(r + 1)) : n.attribute = e.substr(t + 1), n
        }, t.parseSsrcGroup = function (e) {
            var t = e.substr(13).split(" ");
            return {
                semantics: t.shift(),
                ssrcs: t.map((function (e) {
                    return parseInt(e, 10)
                }))
            }
        }, t.getMid = function (e) {
            var n = t.matchPrefix(e, "a=mid:")[0];
            if (n) return n.substr(6)
        }, t.parseFingerprint = function (e) {
            var t = e.substr(14).split(" ");
            return {
                algorithm: t[0].toLowerCase(),
                value: t[1]
            }
        }, t.getDtlsParameters = function (e, n) {
            return {
                role: "auto",
                fingerprints: t.matchPrefix(e + n, "a=fingerprint:").map(t.parseFingerprint)
            }
        }, t.writeDtlsParameters = function (e, t) {
            var n = "a=setup:" + t + "\r\n";
            return e.fingerprints.forEach((function (e) {
                n += "a=fingerprint:" + e.algorithm + " " + e.value + "\r\n"
            })), n
        }, t.parseCryptoLine = function (e) {
            var t = e.substr(9).split(" ");
            return {
                tag: parseInt(t[0], 10),
                cryptoSuite: t[1],
                keyParams: t[2],
                sessionParams: t.slice(3)
            }
        }, t.writeCryptoLine = function (e) {
            return "a=crypto:" + e.tag + " " + e.cryptoSuite + " " + ("object" == typeof e.keyParams ? t.writeCryptoKeyParams(e.keyParams) : e.keyParams) + (e.sessionParams ? " " + e.sessionParams.join(" ") : "") + "\r\n"
        }, t.parseCryptoKeyParams = function (e) {
            if (0 !== e.indexOf("inline:")) return null;
            var t = e.substr(7).split("|");
            return {
                keyMethod: "inline",
                keySalt: t[0],
                lifeTime: t[1],
                mkiValue: t[2] ? t[2].split(":")[0] : void 0,
                mkiLength: t[2] ? t[2].split(":")[1] : void 0
            }
        }, t.writeCryptoKeyParams = function (e) {
            return e.keyMethod + ":" + e.keySalt + (e.lifeTime ? "|" + e.lifeTime : "") + (e.mkiValue && e.mkiLength ? "|" + e.mkiValue + ":" + e.mkiLength : "")
        }, t.getCryptoParameters = function (e, n) {
            return t.matchPrefix(e + n, "a=crypto:").map(t.parseCryptoLine)
        }, t.getIceParameters = function (e, n) {
            var r = t.matchPrefix(e + n, "a=ice-ufrag:")[0],
                i = t.matchPrefix(e + n, "a=ice-pwd:")[0];
            return r && i ? {
                usernameFragment: r.substr(12),
                password: i.substr(10)
            } : null
        }, t.writeIceParameters = function (e) {
            return "a=ice-ufrag:" + e.usernameFragment + "\r\na=ice-pwd:" + e.password + "\r\n"
        }, t.parseRtpParameters = function (e) {
            for (var n = {
                codecs: [],
                headerExtensions: [],
                fecMechanisms: [],
                rtcp: []
            }, r = t.splitLines(e)[0].split(" "), i = 3; i < r.length; i++) {
                var a = r[i],
                    o = t.matchPrefix(e, "a=rtpmap:" + a + " ")[0];
                if (o) {
                    var s = t.parseRtpMap(o),
                        c = t.matchPrefix(e, "a=fmtp:" + a + " ");
                    switch (s.parameters = c.length ? t.parseFmtp(c[0]) : {}, s.rtcpFeedback = t.matchPrefix(e, "a=rtcp-fb:" + a + " ").map(t.parseRtcpFb), n.codecs.push(s), s.name.toUpperCase()) {
                    case "RED":
                    case "ULPFEC":
                        n.fecMechanisms.push(s.name.toUpperCase())
                    }
                }
            }
            return t.matchPrefix(e, "a=extmap:").forEach((function (e) {
                n.headerExtensions.push(t.parseExtmap(e))
            })), n
        }, t.writeRtpDescription = function (e, n) {
            var r = "";
            r += "m=" + e + " ", r += n.codecs.length > 0 ? "9" : "0", r += " UDP/TLS/RTP/SAVPF ", r += n.codecs.map((function (e) {
                return void 0 !== e.preferredPayloadType ? e.preferredPayloadType : e.payloadType
            })).join(" ") + "\r\n", r += "c=IN IP4 0.0.0.0\r\n", r += "a=rtcp:9 IN IP4 0.0.0.0\r\n", n.codecs.forEach((function (e) {
                r += t.writeRtpMap(e), r += t.writeFmtp(e), r += t.writeRtcpFb(e)
            }));
            var i = 0;
            return n.codecs.forEach((function (e) {
                e.maxptime > i && (i = e.maxptime)
            })), i > 0 && (r += "a=maxptime:" + i + "\r\n"), r += "a=rtcp-mux\r\n", n.headerExtensions && n.headerExtensions.forEach((function (e) {
                r += t.writeExtmap(e)
            })), r
        }, t.parseRtpEncodingParameters = function (e) {
            var n, r = [],
                i = t.parseRtpParameters(e),
                a = -1 !== i.fecMechanisms.indexOf("RED"),
                o = -1 !== i.fecMechanisms.indexOf("ULPFEC"),
                s = t.matchPrefix(e, "a=ssrc:").map((function (e) {
                    return t.parseSsrcMedia(e)
                })).filter((function (e) {
                    return "cname" === e.attribute
                })),
                c = s.length > 0 && s[0].ssrc,
                u = t.matchPrefix(e, "a=ssrc-group:FID").map((function (e) {
                    return e.substr(17).split(" ").map((function (e) {
                        return parseInt(e, 10)
                    }))
                }));
            u.length > 0 && u[0].length > 1 && u[0][0] === c && (n = u[0][1]), i.codecs.forEach((function (e) {
                if ("RTX" === e.name.toUpperCase() && e.parameters.apt) {
                    var t = {
                        ssrc: c,
                        codecPayloadType: parseInt(e.parameters.apt, 10)
                    };
                    c && n && (t.rtx = {
                        ssrc: n
                    }), r.push(t), a && ((t = JSON.parse(JSON.stringify(t))).fec = {
                        ssrc: c,
                        mechanism: o ? "red+ulpfec" : "red"
                    }, r.push(t))
                }
            })), 0 === r.length && c && r.push({
                ssrc: c
            });
            var d = t.matchPrefix(e, "b=");
            return d.length && (d = 0 === d[0].indexOf("b=TIAS:") ? parseInt(d[0].substr(7), 10) : 0 === d[0].indexOf("b=AS:") ? 1e3 * parseInt(d[0].substr(5), 10) * .95 - 16e3 : void 0, r.forEach((function (e) {
                e.maxBitrate = d
            }))), r
        }, t.parseRtcpParameters = function (e) {
            var n = {},
                r = t.matchPrefix(e, "a=ssrc:").map((function (e) {
                    return t.parseSsrcMedia(e)
                })).filter((function (e) {
                    return "cname" === e.attribute
                }))[0];
            r && (n.cname = r.value, n.ssrc = r.ssrc);
            var i = t.matchPrefix(e, "a=rtcp-rsize");
            n.reducedSize = i.length > 0, n.compound = 0 === i.length;
            var a = t.matchPrefix(e, "a=rtcp-mux");
            return n.mux = a.length > 0, n
        }, t.parseMsid = function (e) {
            var n, r = t.matchPrefix(e, "a=msid:");
            if (1 === r.length) return {
                stream: (n = r[0].substr(7).split(" "))[0],
                track: n[1]
            };
            var i = t.matchPrefix(e, "a=ssrc:").map((function (e) {
                return t.parseSsrcMedia(e)
            })).filter((function (e) {
                return "msid" === e.attribute
            }));
            return i.length > 0 ? {
                stream: (n = i[0].value.split(" "))[0],
                track: n[1]
            } : void 0
        }, t.parseSctpDescription = function (e) {
            var n, r = t.parseMLine(e),
                i = t.matchPrefix(e, "a=max-message-size:");
            i.length > 0 && (n = parseInt(i[0].substr(19), 10)), isNaN(n) && (n = 65536);
            var a = t.matchPrefix(e, "a=sctp-port:");
            if (a.length > 0) return {
                port: parseInt(a[0].substr(12), 10),
                protocol: r.fmt,
                maxMessageSize: n
            };
            if (t.matchPrefix(e, "a=sctpmap:").length > 0) {
                var o = t.matchPrefix(e, "a=sctpmap:")[0].substr(10).split(" ");
                return {
                    port: parseInt(o[0], 10),
                    protocol: o[1],
                    maxMessageSize: n
                }
            }
        }, t.writeSctpDescription = function (e, t) {
            var n = [];
            return n = "DTLS/SCTP" !== e.protocol ? ["m=" + e.kind + " 9 " + e.protocol + " " + t.protocol + "\r\n", "c=IN IP4 0.0.0.0\r\n", "a=sctp-port:" + t.port + "\r\n"] : ["m=" + e.kind + " 9 " + e.protocol + " " + t.port + "\r\n", "c=IN IP4 0.0.0.0\r\n", "a=sctpmap:" + t.port + " " + t.protocol + " 65535\r\n"], void 0 !== t.maxMessageSize && n.push("a=max-message-size:" + t.maxMessageSize + "\r\n"), n.join("")
        }, t.generateSessionId = function () {
            return Math.random().toString().substr(2, 21)
        }, t.writeSessionBoilerplate = function (e, n, r) {
            var i = void 0 !== n ? n : 2;
            return "v=0\r\no=" + (r || "thisisadapterortc") + " " + (e || t.generateSessionId()) + " " + i + " IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"
        }, t.writeMediaSection = function (e, n, r, i) {
            var a = t.writeRtpDescription(e.kind, n);
            if (a += t.writeIceParameters(e.iceGatherer.getLocalParameters()), a += t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(), "offer" === r ? "actpass" : "active"), a += "a=mid:" + e.mid + "\r\n", e.direction ? a += "a=" + e.direction + "\r\n" : e.rtpSender && e.rtpReceiver ? a += "a=sendrecv\r\n" : e.rtpSender ? a += "a=sendonly\r\n" : e.rtpReceiver ? a += "a=recvonly\r\n" : a += "a=inactive\r\n", e.rtpSender) {
                var o = "msid:" + i.id + " " + e.rtpSender.track.id + "\r\n";
                a += "a=" + o, a += "a=ssrc:" + e.sendEncodingParameters[0].ssrc + " " + o, e.sendEncodingParameters[0].rtx && (a += "a=ssrc:" + e.sendEncodingParameters[0].rtx.ssrc + " " + o, a += "a=ssrc-group:FID " + e.sendEncodingParameters[0].ssrc + " " + e.sendEncodingParameters[0].rtx.ssrc + "\r\n")
            }
            return a += "a=ssrc:" + e.sendEncodingParameters[0].ssrc + " cname:" + t.localCName + "\r\n", e.rtpSender && e.sendEncodingParameters[0].rtx && (a += "a=ssrc:" + e.sendEncodingParameters[0].rtx.ssrc + " cname:" + t.localCName + "\r\n"), a
        }, t.getDirection = function (e, n) {
            for (var r = t.splitLines(e), i = 0; i < r.length; i++) switch (r[i]) {
            case "a=sendrecv":
            case "a=sendonly":
            case "a=recvonly":
            case "a=inactive":
                return r[i].substr(2)
            }
            return n ? t.getDirection(n) : "sendrecv"
        }, t.getKind = function (e) {
            return t.splitLines(e)[0].split(" ")[0].substr(2)
        }, t.isRejected = function (e) {
            return "0" === e.split(" ", 2)[1]
        }, t.parseMLine = function (e) {
            var n = t.splitLines(e)[0].substr(2).split(" ");
            return {
                kind: n[0],
                port: parseInt(n[1], 10),
                protocol: n[2],
                fmt: n.slice(3).join(" ")
            }
        }, t.parseOLine = function (e) {
            var n = t.matchPrefix(e, "o=")[0].substr(2).split(" ");
            return {
                username: n[0],
                sessionId: n[1],
                sessionVersion: parseInt(n[2], 10),
                netType: n[3],
                addressType: n[4],
                address: n[5]
            }
        }, t.isValidSDP = function (e) {
            if ("string" != typeof e || 0 === e.length) return !1;
            for (var n = t.splitLines(e), r = 0; r < n.length; r++)
                if (n[r].length < 2 || "=" !== n[r].charAt(1)) return !1;
            return !0
        }, e.exports = t
    }));

    function Rn(e, t, n, r, i) {
        var a = bn.writeRtpDescription(e.kind, t);
        if (a += bn.writeIceParameters(e.iceGatherer.getLocalParameters()), a += bn.writeDtlsParameters(e.dtlsTransport.getLocalParameters(), "offer" === n ? "actpass" : i || "active"), a += "a=mid:" + e.mid + "\r\n", e.rtpSender && e.rtpReceiver ? a += "a=sendrecv\r\n" : e.rtpSender ? a += "a=sendonly\r\n" : e.rtpReceiver ? a += "a=recvonly\r\n" : a += "a=inactive\r\n", e.rtpSender) {
            var o = e.rtpSender._initialTrackId || e.rtpSender.track.id;
            e.rtpSender._initialTrackId = o;
            var s = "msid:" + (r ? r.id : "-") + " " + o + "\r\n";
            a += "a=" + s, a += "a=ssrc:" + e.sendEncodingParameters[0].ssrc + " " + s, e.sendEncodingParameters[0].rtx && (a += "a=ssrc:" + e.sendEncodingParameters[0].rtx.ssrc + " " + s, a += "a=ssrc-group:FID " + e.sendEncodingParameters[0].ssrc + " " + e.sendEncodingParameters[0].rtx.ssrc + "\r\n")
        }
        return a += "a=ssrc:" + e.sendEncodingParameters[0].ssrc + " cname:" + bn.localCName + "\r\n", e.rtpSender && e.sendEncodingParameters[0].rtx && (a += "a=ssrc:" + e.sendEncodingParameters[0].rtx.ssrc + " cname:" + bn.localCName + "\r\n"), a
    }

    function En(e, t) {
        var n = {
                codecs: [],
                headerExtensions: [],
                fecMechanisms: []
            },
            r = function (e, t) {
                e = parseInt(e, 10);
                for (var n = 0; n < t.length; n++)
                    if (t[n].payloadType === e || t[n].preferredPayloadType === e) return t[n]
            },
            i = function (e, t, n, i) {
                var a = r(e.parameters.apt, n),
                    o = r(t.parameters.apt, i);
                return a && o && a.name.toLowerCase() === o.name.toLowerCase()
            };
        return e.codecs.forEach((function (r) {
            for (var a = 0; a < t.codecs.length; a++) {
                var o = t.codecs[a];
                if (r.name.toLowerCase() === o.name.toLowerCase() && r.clockRate === o.clockRate) {
                    if ("rtx" === r.name.toLowerCase() && r.parameters && o.parameters.apt && !i(r, o, e.codecs, t.codecs)) continue;
                    (o = JSON.parse(JSON.stringify(o))).numChannels = Math.min(r.numChannels, o.numChannels), n.codecs.push(o), o.rtcpFeedback = o.rtcpFeedback.filter((function (e) {
                        for (var t = 0; t < r.rtcpFeedback.length; t++)
                            if (r.rtcpFeedback[t].type === e.type && r.rtcpFeedback[t].parameter === e.parameter) return !0;
                        return !1
                    }));
                    break
                }
            }
        })), e.headerExtensions.forEach((function (e) {
            for (var r = 0; r < t.headerExtensions.length; r++) {
                var i = t.headerExtensions[r];
                if (e.uri === i.uri) {
                    n.headerExtensions.push(i);
                    break
                }
            }
        })), n
    }

    function In(e, t, n) {
        return -1 !== {
            offer: {
                setLocalDescription: ["stable", "have-local-offer"],
                setRemoteDescription: ["stable", "have-remote-offer"]
            },
            answer: {
                setLocalDescription: ["have-remote-offer", "have-local-pranswer"],
                setRemoteDescription: ["have-local-offer", "have-remote-pranswer"]
            }
        }[t][e].indexOf(n)
    }

    function Cn(e, t) {
        var n = e.getRemoteCandidates().find((function (e) {
            return t.foundation === e.foundation && t.ip === e.ip && t.port === e.port && t.priority === e.priority && t.protocol === e.protocol && t.type === e.type
        }));
        return n || e.addRemoteCandidate(t), !n
    }

    function wn(e, t) {
        var n = new Error(t);
        return n.name = e, n.code = {
            NotSupportedError: 9,
            InvalidStateError: 11,
            InvalidAccessError: 15,
            TypeError: void 0,
            OperationError: void 0
        }[e], n
    }
    var An = function (e, t) {
        function n(t, n) {
            n.addTrack(t), n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack", {
                track: t
            }))
        }

        function r(t, n, r, i) {
            var a = new Event("track");
            a.track = n, a.receiver = r, a.transceiver = {
                receiver: r
            }, a.streams = i, e.setTimeout((function () {
                t._dispatchEvent("track", a)
            }))
        }
        var i = function (n) {
            var r = this,
                i = document.createDocumentFragment();
            if (["addEventListener", "removeEventListener", "dispatchEvent"].forEach((function (e) {
                r[e] = i[e].bind(i)
            })), this.canTrickleIceCandidates = null, this.needNegotiation = !1, this.localStreams = [], this.remoteStreams = [], this._localDescription = null, this._remoteDescription = null, this.signalingState = "stable", this.iceConnectionState = "new", this.connectionState = "new", this.iceGatheringState = "new", n = JSON.parse(JSON.stringify(n || {})), this.usingBundle = "max-bundle" === n.bundlePolicy, "negotiate" === n.rtcpMuxPolicy) throw wn("NotSupportedError", "rtcpMuxPolicy 'negotiate' is not supported");
            switch (n.rtcpMuxPolicy || (n.rtcpMuxPolicy = "require"), n.iceTransportPolicy) {
            case "all":
            case "relay":
                break;
            default:
                n.iceTransportPolicy = "all"
            }
            switch (n.bundlePolicy) {
            case "balanced":
            case "max-compat":
            case "max-bundle":
                break;
            default:
                n.bundlePolicy = "balanced"
            }
            if (n.iceServers = function (e, t) {
                var n = !1;
                return (e = JSON.parse(JSON.stringify(e))).filter((function (e) {
                    if (e && (e.urls || e.url)) {
                        var r = e.urls || e.url;
                        e.url && !e.urls && console.warn("RTCIceServer.url is deprecated! Use urls instead.");
                        var i = "string" == typeof r;
                        return i && (r = [r]), r = r.filter((function (e) {
                            return 0 === e.indexOf("turn:") && -1 !== e.indexOf("transport=udp") && -1 === e.indexOf("turn:[") && !n ? (n = !0, !0) : 0 === e.indexOf("stun:") && t >= 14393 && -1 === e.indexOf("?transport=udp")
                        })), delete e.url, e.urls = i ? r[0] : r, !!r.length
                    }
                }))
            }(n.iceServers || [], t), this._iceGatherers = [], n.iceCandidatePoolSize)
                for (var a = n.iceCandidatePoolSize; a > 0; a--) this._iceGatherers.push(new e.RTCIceGatherer({
                    iceServers: n.iceServers,
                    gatherPolicy: n.iceTransportPolicy
                }));
            else n.iceCandidatePoolSize = 0;
            this._config = n, this.transceivers = [], this._sdpSessionId = bn.generateSessionId(), this._sdpSessionVersion = 0, this._dtlsRole = void 0, this._isClosed = !1
        };
        Object.defineProperty(i.prototype, "localDescription", {
            configurable: !0,
            get: function () {
                return this._localDescription
            }
        }), Object.defineProperty(i.prototype, "remoteDescription", {
            configurable: !0,
            get: function () {
                return this._remoteDescription
            }
        }), i.prototype.onicecandidate = null, i.prototype.onaddstream = null, i.prototype.ontrack = null, i.prototype.onremovestream = null, i.prototype.onsignalingstatechange = null, i.prototype.oniceconnectionstatechange = null, i.prototype.onconnectionstatechange = null, i.prototype.onicegatheringstatechange = null, i.prototype.onnegotiationneeded = null, i.prototype.ondatachannel = null, i.prototype._dispatchEvent = function (e, t) {
            this._isClosed || (this.dispatchEvent(t), "function" == typeof this["on" + e] && this["on" + e](t))
        }, i.prototype._emitGatheringStateChange = function () {
            var e = new Event("icegatheringstatechange");
            this._dispatchEvent("icegatheringstatechange", e)
        }, i.prototype.getConfiguration = function () {
            return this._config
        }, i.prototype.getLocalStreams = function () {
            return this.localStreams
        }, i.prototype.getRemoteStreams = function () {
            return this.remoteStreams
        }, i.prototype._createTransceiver = function (e, t) {
            var n = this.transceivers.length > 0,
                r = {
                    track: null,
                    iceGatherer: null,
                    iceTransport: null,
                    dtlsTransport: null,
                    localCapabilities: null,
                    remoteCapabilities: null,
                    rtpSender: null,
                    rtpReceiver: null,
                    kind: e,
                    mid: null,
                    sendEncodingParameters: null,
                    recvEncodingParameters: null,
                    stream: null,
                    associatedRemoteMediaStreams: [],
                    wantReceive: !0
                };
            if (this.usingBundle && n) r.iceTransport = this.transceivers[0].iceTransport, r.dtlsTransport = this.transceivers[0].dtlsTransport;
            else {
                var i = this._createIceAndDtlsTransports();
                r.iceTransport = i.iceTransport, r.dtlsTransport = i.dtlsTransport
            }
            return t || this.transceivers.push(r), r
        }, i.prototype.addTrack = function (t, n) {
            if (this._isClosed) throw wn("InvalidStateError", "Attempted to call addTrack on a closed peerconnection.");
            var r;
            if (this.transceivers.find((function (e) {
                return e.track === t
            }))) throw wn("InvalidAccessError", "Track already exists.");
            for (var i = 0; i < this.transceivers.length; i++) this.transceivers[i].track || this.transceivers[i].kind !== t.kind || (r = this.transceivers[i]);
            return r || (r = this._createTransceiver(t.kind)), this._maybeFireNegotiationNeeded(), -1 === this.localStreams.indexOf(n) && this.localStreams.push(n), r.track = t, r.stream = n, r.rtpSender = new e.RTCRtpSender(t, r.dtlsTransport), r.rtpSender
        }, i.prototype.addStream = function (e) {
            var n = this;
            if (t >= 15025) e.getTracks().forEach((function (t) {
                n.addTrack(t, e)
            }));
            else {
                var r = e.clone();
                e.getTracks().forEach((function (e, t) {
                    var n = r.getTracks()[t];
                    e.addEventListener("enabled", (function (e) {
                        n.enabled = e.enabled
                    }))
                })), r.getTracks().forEach((function (e) {
                    n.addTrack(e, r)
                }))
            }
        }, i.prototype.removeTrack = function (t) {
            if (this._isClosed) throw wn("InvalidStateError", "Attempted to call removeTrack on a closed peerconnection.");
            if (!(t instanceof e.RTCRtpSender)) throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");
            var n = this.transceivers.find((function (e) {
                return e.rtpSender === t
            }));
            if (!n) throw wn("InvalidAccessError", "Sender was not created by this connection.");
            var r = n.stream;
            n.rtpSender.stop(), n.rtpSender = null, n.track = null, n.stream = null, -1 === this.transceivers.map((function (e) {
                return e.stream
            })).indexOf(r) && this.localStreams.indexOf(r) > -1 && this.localStreams.splice(this.localStreams.indexOf(r), 1), this._maybeFireNegotiationNeeded()
        }, i.prototype.removeStream = function (e) {
            var t = this;
            e.getTracks().forEach((function (e) {
                var n = t.getSenders().find((function (t) {
                    return t.track === e
                }));
                n && t.removeTrack(n)
            }))
        }, i.prototype.getSenders = function () {
            return this.transceivers.filter((function (e) {
                return !!e.rtpSender
            })).map((function (e) {
                return e.rtpSender
            }))
        }, i.prototype.getReceivers = function () {
            return this.transceivers.filter((function (e) {
                return !!e.rtpReceiver
            })).map((function (e) {
                return e.rtpReceiver
            }))
        }, i.prototype._createIceGatherer = function (t, n) {
            var r = this;
            if (n && t > 0) return this.transceivers[0].iceGatherer;
            if (this._iceGatherers.length) return this._iceGatherers.shift();
            var i = new e.RTCIceGatherer({
                iceServers: this._config.iceServers,
                gatherPolicy: this._config.iceTransportPolicy
            });
            return Object.defineProperty(i, "state", {
                value: "new",
                writable: !0
            }), this.transceivers[t].bufferedCandidateEvents = [], this.transceivers[t].bufferCandidates = function (e) {
                var n = !e.candidate || 0 === Object.keys(e.candidate).length;
                i.state = n ? "completed" : "gathering", null !== r.transceivers[t].bufferedCandidateEvents && r.transceivers[t].bufferedCandidateEvents.push(e)
            }, i.addEventListener("localcandidate", this.transceivers[t].bufferCandidates), i
        }, i.prototype._gather = function (t, n) {
            var r = this,
                i = this.transceivers[n].iceGatherer;
            if (!i.onlocalcandidate) {
                var a = this.transceivers[n].bufferedCandidateEvents;
                this.transceivers[n].bufferedCandidateEvents = null, i.removeEventListener("localcandidate", this.transceivers[n].bufferCandidates), i.onlocalcandidate = function (e) {
                    if (!(r.usingBundle && n > 0)) {
                        var a = new Event("icecandidate");
                        a.candidate = {
                            sdpMid: t,
                            sdpMLineIndex: n
                        };
                        var o = e.candidate,
                            s = !o || 0 === Object.keys(o).length;
                        if (s) "new" !== i.state && "gathering" !== i.state || (i.state = "completed");
                        else {
                            "new" === i.state && (i.state = "gathering"), o.component = 1, o.ufrag = i.getLocalParameters().usernameFragment;
                            var c = bn.writeCandidate(o);
                            a.candidate = Object.assign(a.candidate, bn.parseCandidate(c)), a.candidate.candidate = c, a.candidate.toJSON = function () {
                                return {
                                    candidate: a.candidate.candidate,
                                    sdpMid: a.candidate.sdpMid,
                                    sdpMLineIndex: a.candidate.sdpMLineIndex,
                                    usernameFragment: a.candidate.usernameFragment
                                }
                            }
                        }
                        var u = bn.getMediaSections(r._localDescription.sdp);
                        u[a.candidate.sdpMLineIndex] += s ? "a=end-of-candidates\r\n" : "a=" + a.candidate.candidate + "\r\n", r._localDescription.sdp = bn.getDescription(r._localDescription.sdp) + u.join("");
                        var d = r.transceivers.every((function (e) {
                            return e.iceGatherer && "completed" === e.iceGatherer.state
                        }));
                        "gathering" !== r.iceGatheringState && (r.iceGatheringState = "gathering", r._emitGatheringStateChange()), s || r._dispatchEvent("icecandidate", a), d && (r._dispatchEvent("icecandidate", new Event("icecandidate")), r.iceGatheringState = "complete", r._emitGatheringStateChange())
                    }
                }, e.setTimeout((function () {
                    a.forEach((function (e) {
                        i.onlocalcandidate(e)
                    }))
                }), 0)
            }
        }, i.prototype._createIceAndDtlsTransports = function () {
            var t = this,
                n = new e.RTCIceTransport(null);
            n.onicestatechange = function () {
                t._updateIceConnectionState(), t._updateConnectionState()
            };
            var r = new e.RTCDtlsTransport(n);
            return r.ondtlsstatechange = function () {
                t._updateConnectionState()
            }, r.onerror = function () {
                Object.defineProperty(r, "state", {
                    value: "failed",
                    writable: !0
                }), t._updateConnectionState()
            }, {
                iceTransport: n,
                dtlsTransport: r
            }
        }, i.prototype._disposeIceAndDtlsTransports = function (e) {
            var t = this.transceivers[e].iceGatherer;
            t && (delete t.onlocalcandidate, delete this.transceivers[e].iceGatherer);
            var n = this.transceivers[e].iceTransport;
            n && (delete n.onicestatechange, delete this.transceivers[e].iceTransport);
            var r = this.transceivers[e].dtlsTransport;
            r && (delete r.ondtlsstatechange, delete r.onerror, delete this.transceivers[e].dtlsTransport)
        }, i.prototype._transceive = function (e, n, r) {
            var i = En(e.localCapabilities, e.remoteCapabilities);
            n && e.rtpSender && (i.encodings = e.sendEncodingParameters, i.rtcp = {
                cname: bn.localCName,
                compound: e.rtcpParameters.compound
            }, e.recvEncodingParameters.length && (i.rtcp.ssrc = e.recvEncodingParameters[0].ssrc), e.rtpSender.send(i)), r && e.rtpReceiver && i.codecs.length > 0 && ("video" === e.kind && e.recvEncodingParameters && t < 15019 && e.recvEncodingParameters.forEach((function (e) {
                delete e.rtx
            })), e.recvEncodingParameters.length ? i.encodings = e.recvEncodingParameters : i.encodings = [{}], i.rtcp = {
                compound: e.rtcpParameters.compound
            }, e.rtcpParameters.cname && (i.rtcp.cname = e.rtcpParameters.cname), e.sendEncodingParameters.length && (i.rtcp.ssrc = e.sendEncodingParameters[0].ssrc), e.rtpReceiver.receive(i))
        }, i.prototype.setLocalDescription = function (e) {
            var t, n, r = this;
            if (-1 === ["offer", "answer"].indexOf(e.type)) return Promise.reject(wn("TypeError", 'Unsupported type "' + e.type + '"'));
            if (!In("setLocalDescription", e.type, r.signalingState) || r._isClosed) return Promise.reject(wn("InvalidStateError", "Can not set local " + e.type + " in state " + r.signalingState));
            if ("offer" === e.type) t = bn.splitSections(e.sdp), n = t.shift(), t.forEach((function (e, t) {
                var n = bn.parseRtpParameters(e);
                r.transceivers[t].localCapabilities = n
            })), r.transceivers.forEach((function (e, t) {
                r._gather(e.mid, t)
            }));
            else if ("answer" === e.type) {
                t = bn.splitSections(r._remoteDescription.sdp), n = t.shift();
                var i = bn.matchPrefix(n, "a=ice-lite").length > 0;
                t.forEach((function (e, t) {
                    var a = r.transceivers[t],
                        o = a.iceGatherer,
                        s = a.iceTransport,
                        c = a.dtlsTransport,
                        u = a.localCapabilities,
                        d = a.remoteCapabilities;
                    if (!(bn.isRejected(e) && 0 === bn.matchPrefix(e, "a=bundle-only").length) && !a.rejected) {
                        var l = bn.getIceParameters(e, n),
                            h = bn.getDtlsParameters(e, n);
                        i && (h.role = "server"), r.usingBundle && 0 !== t || (r._gather(a.mid, t), "new" === s.state && s.start(o, l, i ? "controlling" : "controlled"), "new" === c.state && c.start(h));
                        var p = En(u, d);
                        r._transceive(a, p.codecs.length > 0, !1)
                    }
                }))
            }
            return r._localDescription = {
                type: e.type,
                sdp: e.sdp
            }, "offer" === e.type ? r._updateSignalingState("have-local-offer") : r._updateSignalingState("stable"), Promise.resolve()
        }, i.prototype.setRemoteDescription = function (i) {
            var a = this;
            if (-1 === ["offer", "answer"].indexOf(i.type)) return Promise.reject(wn("TypeError", 'Unsupported type "' + i.type + '"'));
            if (!In("setRemoteDescription", i.type, a.signalingState) || a._isClosed) return Promise.reject(wn("InvalidStateError", "Can not set remote " + i.type + " in state " + a.signalingState));
            var o = {};
            a.remoteStreams.forEach((function (e) {
                o[e.id] = e
            }));
            var s = [],
                c = bn.splitSections(i.sdp),
                u = c.shift(),
                d = bn.matchPrefix(u, "a=ice-lite").length > 0,
                l = bn.matchPrefix(u, "a=group:BUNDLE ").length > 0;
            a.usingBundle = l;
            var h = bn.matchPrefix(u, "a=ice-options:")[0];
            return a.canTrickleIceCandidates = !!h && h.substr(14).split(" ").indexOf("trickle") >= 0, c.forEach((function (r, c) {
                var h = bn.splitLines(r),
                    p = bn.getKind(r),
                    f = bn.isRejected(r) && 0 === bn.matchPrefix(r, "a=bundle-only").length,
                    m = h[0].substr(2).split(" ")[2],
                    _ = bn.getDirection(r, u),
                    v = bn.parseMsid(r),
                    g = bn.getMid(r) || bn.generateIdentifier();
                if (f || "application" === p && ("DTLS/SCTP" === m || "UDP/DTLS/SCTP" === m)) a.transceivers[c] = {
                    mid: g,
                    kind: p,
                    protocol: m,
                    rejected: !0
                };
                else {
                    var S, y, T, k, b, R, E, I, C;
                    !f && a.transceivers[c] && a.transceivers[c].rejected && (a.transceivers[c] = a._createTransceiver(p, !0));
                    var w, A, P = bn.parseRtpParameters(r);
                    f || (w = bn.getIceParameters(r, u), (A = bn.getDtlsParameters(r, u)).role = "client"), E = bn.parseRtpEncodingParameters(r);
                    var D = bn.parseRtcpParameters(r),
                        x = bn.matchPrefix(r, "a=end-of-candidates", u).length > 0,
                        O = bn.matchPrefix(r, "a=candidate:").map((function (e) {
                            return bn.parseCandidate(e)
                        })).filter((function (e) {
                            return 1 === e.component
                        }));
                    if (("offer" === i.type || "answer" === i.type) && !f && l && c > 0 && a.transceivers[c] && (a._disposeIceAndDtlsTransports(c), a.transceivers[c].iceGatherer = a.transceivers[0].iceGatherer, a.transceivers[c].iceTransport = a.transceivers[0].iceTransport, a.transceivers[c].dtlsTransport = a.transceivers[0].dtlsTransport, a.transceivers[c].rtpSender && a.transceivers[c].rtpSender.setTransport(a.transceivers[0].dtlsTransport), a.transceivers[c].rtpReceiver && a.transceivers[c].rtpReceiver.setTransport(a.transceivers[0].dtlsTransport)), "offer" !== i.type || f) {
                        if ("answer" === i.type && !f) {
                            y = (S = a.transceivers[c]).iceGatherer, T = S.iceTransport, k = S.dtlsTransport, b = S.rtpReceiver, R = S.sendEncodingParameters, I = S.localCapabilities, a.transceivers[c].recvEncodingParameters = E, a.transceivers[c].remoteCapabilities = P, a.transceivers[c].rtcpParameters = D, O.length && "new" === T.state && (!d && !x || l && 0 !== c ? O.forEach((function (e) {
                                Cn(S.iceTransport, e)
                            })) : T.setRemoteCandidates(O)), l && 0 !== c || ("new" === T.state && T.start(y, w, "controlling"), "new" === k.state && k.start(A)), !En(S.localCapabilities, S.remoteCapabilities).codecs.filter((function (e) {
                                return "rtx" === e.name.toLowerCase()
                            })).length && S.sendEncodingParameters[0].rtx && delete S.sendEncodingParameters[0].rtx, a._transceive(S, "sendrecv" === _ || "recvonly" === _, "sendrecv" === _ || "sendonly" === _), !b || "sendrecv" !== _ && "sendonly" !== _ ? delete S.rtpReceiver : (C = b.track, v ? (o[v.stream] || (o[v.stream] = new e.MediaStream), n(C, o[v.stream]), s.push([C, b, o[v.stream]])) : (o.default || (o.default = new e.MediaStream), n(C, o.default), s.push([C, b, o.default])))
                        }
                    } else {
                        (S = a.transceivers[c] || a._createTransceiver(p)).mid = g, S.iceGatherer || (S.iceGatherer = a._createIceGatherer(c, l)), O.length && "new" === S.iceTransport.state && (!x || l && 0 !== c ? O.forEach((function (e) {
                            Cn(S.iceTransport, e)
                        })) : S.iceTransport.setRemoteCandidates(O)), I = e.RTCRtpReceiver.getCapabilities(p), t < 15019 && (I.codecs = I.codecs.filter((function (e) {
                            return "rtx" !== e.name
                        }))), R = S.sendEncodingParameters || [{
                            ssrc: 1001 * (2 * c + 2)
                        }];
                        var N, M = !1;
                        if ("sendrecv" === _ || "sendonly" === _) {
                            if (M = !S.rtpReceiver, b = S.rtpReceiver || new e.RTCRtpReceiver(S.dtlsTransport, p), M) C = b.track, v && "-" === v.stream || (v ? (o[v.stream] || (o[v.stream] = new e.MediaStream, Object.defineProperty(o[v.stream], "id", {
                                get: function () {
                                    return v.stream
                                }
                            })), Object.defineProperty(C, "id", {
                                get: function () {
                                    return v.track
                                }
                            }), N = o[v.stream]) : (o.default || (o.default = new e.MediaStream), N = o.default)), N && (n(C, N), S.associatedRemoteMediaStreams.push(N)), s.push([C, b, N])
                        } else S.rtpReceiver && S.rtpReceiver.track && (S.associatedRemoteMediaStreams.forEach((function (t) {
                            var n = t.getTracks().find((function (e) {
                                return e.id === S.rtpReceiver.track.id
                            }));
                            n && function (t, n) {
                                n.removeTrack(t), n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack", {
                                    track: t
                                }))
                            }(n, t)
                        })), S.associatedRemoteMediaStreams = []);
                        S.localCapabilities = I, S.remoteCapabilities = P, S.rtpReceiver = b, S.rtcpParameters = D, S.sendEncodingParameters = R, S.recvEncodingParameters = E, a._transceive(a.transceivers[c], !1, M)
                    }
                }
            })), void 0 === a._dtlsRole && (a._dtlsRole = "offer" === i.type ? "active" : "passive"), a._remoteDescription = {
                type: i.type,
                sdp: i.sdp
            }, "offer" === i.type ? a._updateSignalingState("have-remote-offer") : a._updateSignalingState("stable"), Object.keys(o).forEach((function (t) {
                var n = o[t];
                if (n.getTracks().length) {
                    if (-1 === a.remoteStreams.indexOf(n)) {
                        a.remoteStreams.push(n);
                        var i = new Event("addstream");
                        i.stream = n, e.setTimeout((function () {
                            a._dispatchEvent("addstream", i)
                        }))
                    }
                    s.forEach((function (e) {
                        var t = e[0],
                            i = e[1];
                        n.id === e[2].id && r(a, t, i, [n])
                    }))
                }
            })), s.forEach((function (e) {
                e[2] || r(a, e[0], e[1], [])
            })), e.setTimeout((function () {
                a && a.transceivers && a.transceivers.forEach((function (e) {
                    e.iceTransport && "new" === e.iceTransport.state && e.iceTransport.getRemoteCandidates().length > 0 && (console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"), e.iceTransport.addRemoteCandidate({}))
                }))
            }), 4e3), Promise.resolve()
        }, i.prototype.close = function () {
            this.transceivers.forEach((function (e) {
                e.iceTransport && e.iceTransport.stop(), e.dtlsTransport && e.dtlsTransport.stop(), e.rtpSender && e.rtpSender.stop(), e.rtpReceiver && e.rtpReceiver.stop()
            })), this._isClosed = !0, this._updateSignalingState("closed")
        }, i.prototype._updateSignalingState = function (e) {
            this.signalingState = e;
            var t = new Event("signalingstatechange");
            this._dispatchEvent("signalingstatechange", t)
        }, i.prototype._maybeFireNegotiationNeeded = function () {
            var t = this;
            "stable" === this.signalingState && !0 !== this.needNegotiation && (this.needNegotiation = !0, e.setTimeout((function () {
                if (t.needNegotiation) {
                    t.needNegotiation = !1;
                    var e = new Event("negotiationneeded");
                    t._dispatchEvent("negotiationneeded", e)
                }
            }), 0))
        }, i.prototype._updateIceConnectionState = function () {
            var e, t = {
                new: 0,
                closed: 0,
                checking: 0,
                connected: 0,
                completed: 0,
                disconnected: 0,
                failed: 0
            };
            if (this.transceivers.forEach((function (e) {
                e.iceTransport && !e.rejected && t[e.iceTransport.state]++
            })), e = "new", t.failed > 0 ? e = "failed" : t.checking > 0 ? e = "checking" : t.disconnected > 0 ? e = "disconnected" : t.new > 0 ? e = "new" : t.connected > 0 ? e = "connected" : t.completed > 0 && (e = "completed"), e !== this.iceConnectionState) {
                this.iceConnectionState = e;
                var n = new Event("iceconnectionstatechange");
                this._dispatchEvent("iceconnectionstatechange", n)
            }
        }, i.prototype._updateConnectionState = function () {
            var e, t = {
                new: 0,
                closed: 0,
                connecting: 0,
                connected: 0,
                completed: 0,
                disconnected: 0,
                failed: 0
            };
            if (this.transceivers.forEach((function (e) {
                e.iceTransport && e.dtlsTransport && !e.rejected && (t[e.iceTransport.state]++, t[e.dtlsTransport.state]++)
            })), t.connected += t.completed, e = "new", t.failed > 0 ? e = "failed" : t.connecting > 0 ? e = "connecting" : t.disconnected > 0 ? e = "disconnected" : t.new > 0 ? e = "new" : t.connected > 0 && (e = "connected"), e !== this.connectionState) {
                this.connectionState = e;
                var n = new Event("connectionstatechange");
                this._dispatchEvent("connectionstatechange", n)
            }
        }, i.prototype.createOffer = function () {
            var n = this;
            if (n._isClosed) return Promise.reject(wn("InvalidStateError", "Can not call createOffer after close"));
            var r = n.transceivers.filter((function (e) {
                    return "audio" === e.kind
                })).length,
                i = n.transceivers.filter((function (e) {
                    return "video" === e.kind
                })).length,
                a = arguments[0];
            if (a) {
                if (a.mandatory || a.optional) throw new TypeError("Legacy mandatory/optional constraints not supported.");
                void 0 !== a.offerToReceiveAudio && (r = !0 === a.offerToReceiveAudio ? 1 : !1 === a.offerToReceiveAudio ? 0 : a.offerToReceiveAudio), void 0 !== a.offerToReceiveVideo && (i = !0 === a.offerToReceiveVideo ? 1 : !1 === a.offerToReceiveVideo ? 0 : a.offerToReceiveVideo)
            }
            for (n.transceivers.forEach((function (e) {
                "audio" === e.kind ? --r < 0 && (e.wantReceive = !1) : "video" === e.kind && --i < 0 && (e.wantReceive = !1)
            })); r > 0 || i > 0;) r > 0 && (n._createTransceiver("audio"), r--), i > 0 && (n._createTransceiver("video"), i--);
            var o = bn.writeSessionBoilerplate(n._sdpSessionId, n._sdpSessionVersion++);
            n.transceivers.forEach((function (r, i) {
                var a = r.track,
                    o = r.kind,
                    s = r.mid || bn.generateIdentifier();
                r.mid = s, r.iceGatherer || (r.iceGatherer = n._createIceGatherer(i, n.usingBundle));
                var c = e.RTCRtpSender.getCapabilities(o);
                t < 15019 && (c.codecs = c.codecs.filter((function (e) {
                    return "rtx" !== e.name
                }))), c.codecs.forEach((function (e) {
                    "H264" === e.name && void 0 === e.parameters["level-asymmetry-allowed"] && (e.parameters["level-asymmetry-allowed"] = "1"), r.remoteCapabilities && r.remoteCapabilities.codecs && r.remoteCapabilities.codecs.forEach((function (t) {
                        e.name.toLowerCase() === t.name.toLowerCase() && e.clockRate === t.clockRate && (e.preferredPayloadType = t.payloadType)
                    }))
                })), c.headerExtensions.forEach((function (e) {
                    (r.remoteCapabilities && r.remoteCapabilities.headerExtensions || []).forEach((function (t) {
                        e.uri === t.uri && (e.id = t.id)
                    }))
                }));
                var u = r.sendEncodingParameters || [{
                    ssrc: 1001 * (2 * i + 1)
                }];
                a && t >= 15019 && "video" === o && !u[0].rtx && (u[0].rtx = {
                    ssrc: u[0].ssrc + 1
                }), r.wantReceive && (r.rtpReceiver = new e.RTCRtpReceiver(r.dtlsTransport, o)), r.localCapabilities = c, r.sendEncodingParameters = u
            })), "max-compat" !== n._config.bundlePolicy && (o += "a=group:BUNDLE " + n.transceivers.map((function (e) {
                return e.mid
            })).join(" ") + "\r\n"), o += "a=ice-options:trickle\r\n", n.transceivers.forEach((function (e, t) {
                o += Rn(e, e.localCapabilities, "offer", e.stream, n._dtlsRole), o += "a=rtcp-rsize\r\n", !e.iceGatherer || "new" === n.iceGatheringState || 0 !== t && n.usingBundle || (e.iceGatherer.getLocalCandidates().forEach((function (e) {
                    e.component = 1, o += "a=" + bn.writeCandidate(e) + "\r\n"
                })), "completed" === e.iceGatherer.state && (o += "a=end-of-candidates\r\n"))
            }));
            var s = new e.RTCSessionDescription({
                type: "offer",
                sdp: o
            });
            return Promise.resolve(s)
        }, i.prototype.createAnswer = function () {
            var n = this;
            if (n._isClosed) return Promise.reject(wn("InvalidStateError", "Can not call createAnswer after close"));
            if ("have-remote-offer" !== n.signalingState && "have-local-pranswer" !== n.signalingState) return Promise.reject(wn("InvalidStateError", "Can not call createAnswer in signalingState " + n.signalingState));
            var r = bn.writeSessionBoilerplate(n._sdpSessionId, n._sdpSessionVersion++);
            n.usingBundle && (r += "a=group:BUNDLE " + n.transceivers.map((function (e) {
                return e.mid
            })).join(" ") + "\r\n"), r += "a=ice-options:trickle\r\n";
            var i = bn.getMediaSections(n._remoteDescription.sdp).length;
            n.transceivers.forEach((function (e, a) {
                if (!(a + 1 > i)) {
                    if (e.rejected) return "application" === e.kind ? "DTLS/SCTP" === e.protocol ? r += "m=application 0 DTLS/SCTP 5000\r\n" : r += "m=application 0 " + e.protocol + " webrtc-datachannel\r\n" : "audio" === e.kind ? r += "m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n" : "video" === e.kind && (r += "m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"), void(r += "c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:" + e.mid + "\r\n");
                    var o;
                    if (e.stream) "audio" === e.kind ? o = e.stream.getAudioTracks()[0] : "video" === e.kind && (o = e.stream.getVideoTracks()[0]), o && t >= 15019 && "video" === e.kind && !e.sendEncodingParameters[0].rtx && (e.sendEncodingParameters[0].rtx = {
                        ssrc: e.sendEncodingParameters[0].ssrc + 1
                    });
                    var s = En(e.localCapabilities, e.remoteCapabilities);
                    !s.codecs.filter((function (e) {
                        return "rtx" === e.name.toLowerCase()
                    })).length && e.sendEncodingParameters[0].rtx && delete e.sendEncodingParameters[0].rtx, r += Rn(e, s, "answer", e.stream, n._dtlsRole), e.rtcpParameters && e.rtcpParameters.reducedSize && (r += "a=rtcp-rsize\r\n")
                }
            }));
            var a = new e.RTCSessionDescription({
                type: "answer",
                sdp: r
            });
            return Promise.resolve(a)
        }, i.prototype.addIceCandidate = function (e) {
            var t, n = this;
            return e && void 0 === e.sdpMLineIndex && !e.sdpMid ? Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")) : new Promise((function (r, i) {
                if (!n._remoteDescription) return i(wn("InvalidStateError", "Can not add ICE candidate without a remote description"));
                if (e && "" !== e.candidate) {
                    var a = e.sdpMLineIndex;
                    if (e.sdpMid)
                        for (var o = 0; o < n.transceivers.length; o++)
                            if (n.transceivers[o].mid === e.sdpMid) {
                                a = o;
                                break
                            }
                    var s = n.transceivers[a];
                    if (!s) return i(wn("OperationError", "Can not add ICE candidate"));
                    if (s.rejected) return r();
                    var c = Object.keys(e.candidate).length > 0 ? bn.parseCandidate(e.candidate) : {};
                    if ("tcp" === c.protocol && (0 === c.port || 9 === c.port)) return r();
                    if (c.component && 1 !== c.component) return r();
                    if ((0 === a || a > 0 && s.iceTransport !== n.transceivers[0].iceTransport) && !Cn(s.iceTransport, c)) return i(wn("OperationError", "Can not add ICE candidate"));
                    var u = e.candidate.trim();
                    0 === u.indexOf("a=") && (u = u.substr(2)), (t = bn.getMediaSections(n._remoteDescription.sdp))[a] += "a=" + (c.type ? u : "end-of-candidates") + "\r\n", n._remoteDescription.sdp = bn.getDescription(n._remoteDescription.sdp) + t.join("")
                } else
                    for (var d = 0; d < n.transceivers.length && (n.transceivers[d].rejected || (n.transceivers[d].iceTransport.addRemoteCandidate({}), (t = bn.getMediaSections(n._remoteDescription.sdp))[d] += "a=end-of-candidates\r\n", n._remoteDescription.sdp = bn.getDescription(n._remoteDescription.sdp) + t.join(""), !n.usingBundle)); d++);
                r()
            }))
        }, i.prototype.getStats = function (t) {
            if (t && t instanceof e.MediaStreamTrack) {
                var n = null;
                if (this.transceivers.forEach((function (e) {
                    e.rtpSender && e.rtpSender.track === t ? n = e.rtpSender : e.rtpReceiver && e.rtpReceiver.track === t && (n = e.rtpReceiver)
                })), !n) throw wn("InvalidAccessError", "Invalid selector.");
                return n.getStats()
            }
            var r = [];
            return this.transceivers.forEach((function (e) {
                ["rtpSender", "rtpReceiver", "iceGatherer", "iceTransport", "dtlsTransport"].forEach((function (t) {
                    e[t] && r.push(e[t].getStats())
                }))
            })), Promise.all(r).then((function (e) {
                var t = new Map;
                return e.forEach((function (e) {
                    e.forEach((function (e) {
                        t.set(e.id, e)
                    }))
                })), t
            }))
        };
        ["RTCRtpSender", "RTCRtpReceiver", "RTCIceGatherer", "RTCIceTransport", "RTCDtlsTransport"].forEach((function (t) {
            var n = e[t];
            if (n && n.prototype && n.prototype.getStats) {
                var r = n.prototype.getStats;
                n.prototype.getStats = function () {
                    return r.apply(this).then((function (e) {
                        var t = new Map;
                        return Object.keys(e).forEach((function (n) {
                            var r;
                            e[n].type = {
                                inboundrtp: "inbound-rtp",
                                outboundrtp: "outbound-rtp",
                                candidatepair: "candidate-pair",
                                localcandidate: "local-candidate",
                                remotecandidate: "remote-candidate"
                            }[(r = e[n]).type] || r.type, t.set(n, e[n])
                        })), t
                    }))
                }
            }
        }));
        var a = ["createOffer", "createAnswer"];
        return a.forEach((function (e) {
            var t = i.prototype[e];
            i.prototype[e] = function () {
                var e = arguments;
                return "function" == typeof e[0] || "function" == typeof e[1] ? t.apply(this, [arguments[2]]).then((function (t) {
                    "function" == typeof e[0] && e[0].apply(null, [t])
                }), (function (t) {
                    "function" == typeof e[1] && e[1].apply(null, [t])
                })) : t.apply(this, arguments)
            }
        })), (a = ["setLocalDescription", "setRemoteDescription", "addIceCandidate"]).forEach((function (e) {
            var t = i.prototype[e];
            i.prototype[e] = function () {
                var e = arguments;
                return "function" == typeof e[1] || "function" == typeof e[2] ? t.apply(this, arguments).then((function () {
                    "function" == typeof e[1] && e[1].apply(null)
                }), (function (t) {
                    "function" == typeof e[2] && e[2].apply(null, [t])
                })) : t.apply(this, arguments)
            }
        })), ["getStats"].forEach((function (e) {
            var t = i.prototype[e];
            i.prototype[e] = function () {
                var e = arguments;
                return "function" == typeof e[1] ? t.apply(this, arguments).then((function () {
                    "function" == typeof e[1] && e[1].apply(null)
                })) : t.apply(this, arguments)
            }
        })), i
    };

    function Pn(e) {
        const t = e && e.navigator,
            n = t.mediaDevices.getUserMedia.bind(t.mediaDevices);
        t.mediaDevices.getUserMedia = function (e) {
            return n(e).catch(e => Promise.reject(function (e) {
                return {
                    name: {
                        PermissionDeniedError: "NotAllowedError"
                    }[e.name] || e.name,
                    message: e.message,
                    constraint: e.constraint,
                    toString() {
                        return this.name
                    }
                }
            }(e)))
        }
    }

    function Dn(e) {
        "getDisplayMedia" in e.navigator && e.navigator.mediaDevices && (e.navigator.mediaDevices && "getDisplayMedia" in e.navigator.mediaDevices || (e.navigator.mediaDevices.getDisplayMedia = e.navigator.getDisplayMedia.bind(e.navigator)))
    }

    function xn(e, t) {
        if (e.RTCIceGatherer && (e.RTCIceCandidate || (e.RTCIceCandidate = function (e) {
            return e
        }), e.RTCSessionDescription || (e.RTCSessionDescription = function (e) {
            return e
        }), t.version < 15025)) {
            const t = Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype, "enabled");
            Object.defineProperty(e.MediaStreamTrack.prototype, "enabled", {
                set(e) {
                    t.set.call(this, e);
                    const n = new Event("enabled");
                    n.enabled = e, this.dispatchEvent(n)
                }
            })
        }
        e.RTCRtpSender && !("dtmf" in e.RTCRtpSender.prototype) && Object.defineProperty(e.RTCRtpSender.prototype, "dtmf", {
            get() {
                return void 0 === this._dtmf && ("audio" === this.track.kind ? this._dtmf = new e.RTCDtmfSender(this) : "video" === this.track.kind && (this._dtmf = null)), this._dtmf
            }
        }), e.RTCDtmfSender && !e.RTCDTMFSender && (e.RTCDTMFSender = e.RTCDtmfSender);
        const n = An(e, t.version);
        e.RTCPeerConnection = function (e) {
            return e && e.iceServers && (e.iceServers = function (e, t) {
                let n = !1;
                return (e = JSON.parse(JSON.stringify(e))).filter(e => {
                    if (e && (e.urls || e.url)) {
                        let t = e.urls || e.url;
                        e.url && !e.urls && sn("RTCIceServer.url", "RTCIceServer.urls");
                        const r = "string" == typeof t;
                        return r && (t = [t]), t = t.filter(e => {
                            if (0 === e.indexOf("stun:")) return !1;
                            const t = e.startsWith("turn") && !e.startsWith("turn:[") && e.includes("transport=udp");
                            return t && !n ? (n = !0, !0) : t && !n
                        }), delete e.url, e.urls = r ? t[0] : t, !!t.length
                    }
                })
            }(e.iceServers, t.version), on("ICE servers after filtering:", e.iceServers)), new n(e)
        }, e.RTCPeerConnection.prototype = n.prototype
    }

    function On(e) {
        e.RTCRtpSender && !("replaceTrack" in e.RTCRtpSender.prototype) && (e.RTCRtpSender.prototype.replaceTrack = e.RTCRtpSender.prototype.setTrack)
    }
    var Nn = Object.freeze({
        __proto__: null,
        shimPeerConnection: xn,
        shimReplaceTrack: On,
        shimGetUserMedia: Pn,
        shimGetDisplayMedia: Dn
    });

    function Mn(e, t) {
        const n = e && e.navigator,
            r = e && e.MediaStreamTrack;
        if (n.getUserMedia = function (e, t, r) {
            sn("navigator.getUserMedia", "navigator.mediaDevices.getUserMedia"), n.mediaDevices.getUserMedia(e).then(t, r)
        }, !(t.version > 55 && "autoGainControl" in n.mediaDevices.getSupportedConstraints())) {
            const e = function (e, t, n) {
                    t in e && !(n in e) && (e[n] = e[t], delete e[t])
                },
                t = n.mediaDevices.getUserMedia.bind(n.mediaDevices);
            if (n.mediaDevices.getUserMedia = function (n) {
                return "object" == typeof n && "object" == typeof n.audio && (n = JSON.parse(JSON.stringify(n)), e(n.audio, "autoGainControl", "mozAutoGainControl"), e(n.audio, "noiseSuppression", "mozNoiseSuppression")), t(n)
            }, r && r.prototype.getSettings) {
                const t = r.prototype.getSettings;
                r.prototype.getSettings = function () {
                    const n = t.apply(this, arguments);
                    return e(n, "mozAutoGainControl", "autoGainControl"), e(n, "mozNoiseSuppression", "noiseSuppression"), n
                }
            }
            if (r && r.prototype.applyConstraints) {
                const t = r.prototype.applyConstraints;
                r.prototype.applyConstraints = function (n) {
                    return "audio" === this.kind && "object" == typeof n && (n = JSON.parse(JSON.stringify(n)), e(n, "autoGainControl", "mozAutoGainControl"), e(n, "noiseSuppression", "mozNoiseSuppression")), t.apply(this, [n])
                }
            }
        }
    }

    function Ln(e) {
        "object" == typeof e && e.RTCTrackEvent && "receiver" in e.RTCTrackEvent.prototype && !("transceiver" in e.RTCTrackEvent.prototype) && Object.defineProperty(e.RTCTrackEvent.prototype, "transceiver", {
            get() {
                return {
                    receiver: this.receiver
                }
            }
        })
    }

    function Vn(e, t) {
        if ("object" != typeof e || !e.RTCPeerConnection && !e.mozRTCPeerConnection) return;
        !e.RTCPeerConnection && e.mozRTCPeerConnection && (e.RTCPeerConnection = e.mozRTCPeerConnection), t.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach((function (t) {
            const n = e.RTCPeerConnection.prototype[t],
                r = {
                    [t]() {
                        return arguments[0] = new("addIceCandidate" === t ? e.RTCIceCandidate : e.RTCSessionDescription)(arguments[0]), n.apply(this, arguments)
                    }
                };
            e.RTCPeerConnection.prototype[t] = r[t]
        }));
        const n = {
                inboundrtp: "inbound-rtp",
                outboundrtp: "outbound-rtp",
                candidatepair: "candidate-pair",
                localcandidate: "local-candidate",
                remotecandidate: "remote-candidate"
            },
            r = e.RTCPeerConnection.prototype.getStats;
        e.RTCPeerConnection.prototype.getStats = function () {
            const [e, i, a] = arguments;
            return r.apply(this, [e || null]).then(e => {
                if (t.version < 53 && !i) try {
                    e.forEach(e => {
                        e.type = n[e.type] || e.type
                    })
                } catch (r) {
                    if ("TypeError" !== r.name) throw r;
                    e.forEach((t, r) => {
                        e.set(r, Object.assign({}, t, {
                            type: n[t.type] || t.type
                        }))
                    })
                }
                return e
            }).then(i, a)
        }
    }

    function Un(e) {
        if ("object" != typeof e || !e.RTCPeerConnection || !e.RTCRtpSender) return;
        if (e.RTCRtpSender && "getStats" in e.RTCRtpSender.prototype) return;
        const t = e.RTCPeerConnection.prototype.getSenders;
        t && (e.RTCPeerConnection.prototype.getSenders = function () {
            const e = t.apply(this, []);
            return e.forEach(e => e._pc = this), e
        });
        const n = e.RTCPeerConnection.prototype.addTrack;
        n && (e.RTCPeerConnection.prototype.addTrack = function () {
            const e = n.apply(this, arguments);
            return e._pc = this, e
        }), e.RTCRtpSender.prototype.getStats = function () {
            return this.track ? this._pc.getStats(this.track) : Promise.resolve(new Map)
        }
    }

    function Fn(e) {
        if ("object" != typeof e || !e.RTCPeerConnection || !e.RTCRtpSender) return;
        if (e.RTCRtpSender && "getStats" in e.RTCRtpReceiver.prototype) return;
        const t = e.RTCPeerConnection.prototype.getReceivers;
        t && (e.RTCPeerConnection.prototype.getReceivers = function () {
            const e = t.apply(this, []);
            return e.forEach(e => e._pc = this), e
        }), nn(e, "track", e => (e.receiver._pc = e.srcElement, e)), e.RTCRtpReceiver.prototype.getStats = function () {
            return this._pc.getStats(this.track)
        }
    }

    function jn(e) {
        e.RTCPeerConnection && !("removeStream" in e.RTCPeerConnection.prototype) && (e.RTCPeerConnection.prototype.removeStream = function (e) {
            sn("removeStream", "removeTrack"), this.getSenders().forEach(t => {
                t.track && e.getTracks().includes(t.track) && this.removeTrack(t)
            })
        })
    }

    function Bn(e) {
        e.DataChannel && !e.RTCDataChannel && (e.RTCDataChannel = e.DataChannel)
    }

    function Hn(e) {
        if ("object" != typeof e || !e.RTCPeerConnection) return;
        const t = e.RTCPeerConnection.prototype.addTransceiver;
        t && (e.RTCPeerConnection.prototype.addTransceiver = function () {
            this.setParametersPromises = [];
            const e = arguments[1],
                n = e && "sendEncodings" in e;
            n && e.sendEncodings.forEach(e => {
                if ("rid" in e) {
                    if (!/^[a-z0-9]{0,16}$/i.test(e.rid)) throw new TypeError("Invalid RID value provided.")
                }
                if ("scaleResolutionDownBy" in e && !(parseFloat(e.scaleResolutionDownBy) >= 1)) throw new RangeError("scale_resolution_down_by must be >= 1.0");
                if ("maxFramerate" in e && !(parseFloat(e.maxFramerate) >= 0)) throw new RangeError("max_framerate must be >= 0.0")
            });
            const r = t.apply(this, arguments);
            if (n) {
                const {
                    sender: t
                } = r, n = t.getParameters();
                (!("encodings" in n) || 1 === n.encodings.length && 0 === Object.keys(n.encodings[0]).length) && (n.encodings = e.sendEncodings, t.sendEncodings = e.sendEncodings, this.setParametersPromises.push(t.setParameters(n).then(() => {
                    delete t.sendEncodings
                }).catch(() => {
                    delete t.sendEncodings
                })))
            }
            return r
        })
    }

    function Gn(e) {
        if ("object" != typeof e || !e.RTCRtpSender) return;
        const t = e.RTCRtpSender.prototype.getParameters;
        t && (e.RTCRtpSender.prototype.getParameters = function () {
            const e = t.apply(this, arguments);
            return "encodings" in e || (e.encodings = [].concat(this.sendEncodings || [{}])), e
        })
    }

    function Jn(e) {
        if ("object" != typeof e || !e.RTCPeerConnection) return;
        const t = e.RTCPeerConnection.prototype.createOffer;
        e.RTCPeerConnection.prototype.createOffer = function () {
            return this.setParametersPromises && this.setParametersPromises.length ? Promise.all(this.setParametersPromises).then(() => t.apply(this, arguments)).finally(() => {
                this.setParametersPromises = []
            }) : t.apply(this, arguments)
        }
    }

    function zn(e) {
        if ("object" != typeof e || !e.RTCPeerConnection) return;
        const t = e.RTCPeerConnection.prototype.createAnswer;
        e.RTCPeerConnection.prototype.createAnswer = function () {
            return this.setParametersPromises && this.setParametersPromises.length ? Promise.all(this.setParametersPromises).then(() => t.apply(this, arguments)).finally(() => {
                this.setParametersPromises = []
            }) : t.apply(this, arguments)
        }
    }
    var Wn = Object.freeze({
        __proto__: null,
        shimOnTrack: Ln,
        shimPeerConnection: Vn,
        shimSenderGetStats: Un,
        shimReceiverGetStats: Fn,
        shimRemoveStream: jn,
        shimRTCDataChannel: Bn,
        shimAddTransceiver: Hn,
        shimGetParameters: Gn,
        shimCreateOffer: Jn,
        shimCreateAnswer: zn,
        shimGetUserMedia: Mn,
        shimGetDisplayMedia: function (e, t) {
            e.navigator.mediaDevices && "getDisplayMedia" in e.navigator.mediaDevices || e.navigator.mediaDevices && (e.navigator.mediaDevices.getDisplayMedia = function (n) {
                if (!n || !n.video) {
                    const e = new DOMException("getDisplayMedia without video constraints is undefined");
                    return e.name = "NotFoundError", e.code = 8, Promise.reject(e)
                }
                return !0 === n.video ? n.video = {
                    mediaSource: t
                } : n.video.mediaSource = t, e.navigator.mediaDevices.getUserMedia(n)
            })
        }
    });

    function shimLocalStreamsAPI(e) {
        if ("object" == typeof e && e.RTCPeerConnection) {
            if ("getLocalStreams" in e.RTCPeerConnection.prototype || (e.RTCPeerConnection.prototype.getLocalStreams = function () {
                return this._localStreams || (this._localStreams = []), this._localStreams
            }), !("addStream" in e.RTCPeerConnection.prototype)) {
                const t = e.RTCPeerConnection.prototype.addTrack;
                e.RTCPeerConnection.prototype.addStream = function (e) {
                    this._localStreams || (this._localStreams = []), this._localStreams.includes(e) || this._localStreams.push(e), e.getAudioTracks().forEach(n => t.call(this, n, e)), e.getVideoTracks().forEach(n => t.call(this, n, e))
                }, e.RTCPeerConnection.prototype.addTrack = function (e, ...n) {
                    return n && n.forEach(e => {
                        this._localStreams ? this._localStreams.includes(e) || this._localStreams.push(e) : this._localStreams = [e]
                    }), t.apply(this, arguments)
                }
            }
            "removeStream" in e.RTCPeerConnection.prototype || (e.RTCPeerConnection.prototype.removeStream = function (e) {
                this._localStreams || (this._localStreams = []);
                const t = this._localStreams.indexOf(e);
                if (-1 === t) return;
                this._localStreams.splice(t, 1);
                const n = e.getTracks();
                this.getSenders().forEach(e => {
                    n.includes(e.track) && this.removeTrack(e)
                })
            })
        }
    }

    function shimRemoteStreamsAPI(e) {
        if ("object" == typeof e && e.RTCPeerConnection && ("getRemoteStreams" in e.RTCPeerConnection.prototype || (e.RTCPeerConnection.prototype.getRemoteStreams = function () {
            return this._remoteStreams ? this._remoteStreams : []
        }), !("onaddstream" in e.RTCPeerConnection.prototype))) {
            Object.defineProperty(e.RTCPeerConnection.prototype, "onaddstream", {
                get() {
                    return this._onaddstream
                }, set(e) {
                    this._onaddstream && (this.removeEventListener("addstream", this._onaddstream), this.removeEventListener("track", this._onaddstreampoly)), this.addEventListener("addstream", this._onaddstream = e), this.addEventListener("track", this._onaddstreampoly = e => {
                        e.streams.forEach(e => {
                            if (this._remoteStreams || (this._remoteStreams = []), this._remoteStreams.includes(e)) return;
                            this._remoteStreams.push(e);
                            const t = new Event("addstream");
                            t.stream = e, this.dispatchEvent(t)
                        })
                    })
                }
            });
            const t = e.RTCPeerConnection.prototype.setRemoteDescription;
            e.RTCPeerConnection.prototype.setRemoteDescription = function () {
                const e = this;
                return this._onaddstreampoly || this.addEventListener("track", this._onaddstreampoly = function (t) {
                    t.streams.forEach(t => {
                        if (e._remoteStreams || (e._remoteStreams = []), e._remoteStreams.indexOf(t) >= 0) return;
                        e._remoteStreams.push(t);
                        const n = new Event("addstream");
                        n.stream = t, e.dispatchEvent(n)
                    })
                }), t.apply(e, arguments)
            }
        }
    }

    function qn(e) {
        if ("object" != typeof e || !e.RTCPeerConnection) return;
        const t = e.RTCPeerConnection.prototype,
            n = t.createOffer,
            r = t.createAnswer,
            i = t.setLocalDescription,
            a = t.setRemoteDescription,
            o = t.addIceCandidate;
        t.createOffer = function (e, t) {
            const r = arguments.length >= 2 ? arguments[2] : arguments[0],
                i = n.apply(this, [r]);
            return t ? (i.then(e, t), Promise.resolve()) : i
        }, t.createAnswer = function (e, t) {
            const n = arguments.length >= 2 ? arguments[2] : arguments[0],
                i = r.apply(this, [n]);
            return t ? (i.then(e, t), Promise.resolve()) : i
        };
        let s = function (e, t, n) {
            const r = i.apply(this, [e]);
            return n ? (r.then(t, n), Promise.resolve()) : r
        };
        t.setLocalDescription = s, s = function (e, t, n) {
            const r = a.apply(this, [e]);
            return n ? (r.then(t, n), Promise.resolve()) : r
        }, t.setRemoteDescription = s, s = function (e, t, n) {
            const r = o.apply(this, [e]);
            return n ? (r.then(t, n), Promise.resolve()) : r
        }, t.addIceCandidate = s
    }

    function Kn(e) {
        const t = e && e.navigator;
        if (t.mediaDevices && t.mediaDevices.getUserMedia) {
            const e = t.mediaDevices,
                n = e.getUserMedia.bind(e);
            t.mediaDevices.getUserMedia = e => n(Qn(e))
        }!t.getUserMedia && t.mediaDevices && t.mediaDevices.getUserMedia && (t.getUserMedia = function (e, n, r) {
            t.mediaDevices.getUserMedia(e).then(n, r)
        }.bind(t))
    }

    function Qn(e) {
        return e && void 0 !== e.video ? Object.assign({}, e, {
            video: un(e.video)
        }) : e
    }

    function Xn(e) {
        if (!e.RTCPeerConnection) return;
        const t = e.RTCPeerConnection;
        e.RTCPeerConnection = function (e, n) {
            if (e && e.iceServers) {
                const t = [];
                for (let n = 0; n < e.iceServers.length; n++) {
                    let r = e.iceServers[n];
                    !r.hasOwnProperty("urls") && r.hasOwnProperty("url") ? (sn("RTCIceServer.url", "RTCIceServer.urls"), r = JSON.parse(JSON.stringify(r)), r.urls = r.url, delete r.url, t.push(r)) : t.push(e.iceServers[n])
                }
                e.iceServers = t
            }
            return new t(e, n)
        }, e.RTCPeerConnection.prototype = t.prototype, "generateCertificate" in t && Object.defineProperty(e.RTCPeerConnection, "generateCertificate", {
            get: () => t.generateCertificate
        })
    }

    function Yn(e) {
        "object" == typeof e && e.RTCTrackEvent && "receiver" in e.RTCTrackEvent.prototype && !("transceiver" in e.RTCTrackEvent.prototype) && Object.defineProperty(e.RTCTrackEvent.prototype, "transceiver", {
            get() {
                return {
                    receiver: this.receiver
                }
            }
        })
    }

    function $n(e) {
        const t = e.RTCPeerConnection.prototype.createOffer;
        e.RTCPeerConnection.prototype.createOffer = function (e) {
            if (e) {
                void 0 !== e.offerToReceiveAudio && (e.offerToReceiveAudio = !!e.offerToReceiveAudio);
                const t = this.getTransceivers().find(e => "audio" === e.receiver.track.kind);
                !1 === e.offerToReceiveAudio && t ? "sendrecv" === t.direction ? t.setDirection ? t.setDirection("sendonly") : t.direction = "sendonly" : "recvonly" === t.direction && (t.setDirection ? t.setDirection("inactive") : t.direction = "inactive") : !0 !== e.offerToReceiveAudio || t || this.addTransceiver("audio"), void 0 !== e.offerToReceiveVideo && (e.offerToReceiveVideo = !!e.offerToReceiveVideo);
                const n = this.getTransceivers().find(e => "video" === e.receiver.track.kind);
                !1 === e.offerToReceiveVideo && n ? "sendrecv" === n.direction ? n.setDirection ? n.setDirection("sendonly") : n.direction = "sendonly" : "recvonly" === n.direction && (n.setDirection ? n.setDirection("inactive") : n.direction = "inactive") : !0 !== e.offerToReceiveVideo || n || this.addTransceiver("video")
            }
            return t.apply(this, arguments)
        }
    }

    function Zn(e) {
        "object" != typeof e || e.AudioContext || (e.AudioContext = e.webkitAudioContext)
    }
    var er = Object.freeze({
        __proto__: null,
        shimLocalStreamsAPI: shimLocalStreamsAPI,
        shimRemoteStreamsAPI: shimRemoteStreamsAPI,
        shimCallbacksAPI: qn,
        shimGetUserMedia: Kn,
        shimConstraints: Qn,
        shimRTCIceServerUrls: Xn,
        shimTrackEventTransceiver: Yn,
        shimCreateOfferLegacy: $n,
        shimAudioContext: Zn
    });

    function tr(e) {
        if (!e.RTCIceCandidate || e.RTCIceCandidate && "foundation" in e.RTCIceCandidate.prototype) return;
        const t = e.RTCIceCandidate;
        e.RTCIceCandidate = function (e) {
            if ("object" == typeof e && e.candidate && 0 === e.candidate.indexOf("a=") && ((e = JSON.parse(JSON.stringify(e))).candidate = e.candidate.substr(2)), e.candidate && e.candidate.length) {
                const n = new t(e),
                    r = bn.parseCandidate(e.candidate),
                    i = Object.assign(n, r);
                return i.toJSON = function () {
                    return {
                        candidate: i.candidate,
                        sdpMid: i.sdpMid,
                        sdpMLineIndex: i.sdpMLineIndex,
                        usernameFragment: i.usernameFragment
                    }
                }, i
            }
            return new t(e)
        }, e.RTCIceCandidate.prototype = t.prototype, nn(e, "icecandidate", t => (t.candidate && Object.defineProperty(t, "candidate", {
            value: new e.RTCIceCandidate(t.candidate),
            writable: "false"
        }), t))
    }

    function nr(e, t) {
        if (!e.RTCPeerConnection) return;
        "sctp" in e.RTCPeerConnection.prototype || Object.defineProperty(e.RTCPeerConnection.prototype, "sctp", {
            get() {
                return void 0 === this._sctp ? null : this._sctp
            }
        });
        const n = function (e) {
                if (!e || !e.sdp) return !1;
                const t = bn.splitSections(e.sdp);
                return t.shift(), t.some(e => {
                    const t = bn.parseMLine(e);
                    return t && "application" === t.kind && -1 !== t.protocol.indexOf("SCTP")
                })
            },
            r = function (e) {
                const t = e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);
                if (null === t || t.length < 2) return -1;
                const n = parseInt(t[1], 10);
                return n != n ? -1 : n
            },
            i = function (e) {
                let n = 65536;
                return "firefox" === t.browser && (n = t.version < 57 ? -1 === e ? 16384 : 2147483637 : t.version < 60 ? 57 === t.version ? 65535 : 65536 : 2147483637), n
            },
            a = function (e, n) {
                let r = 65536;
                "firefox" === t.browser && 57 === t.version && (r = 65535);
                const i = bn.matchPrefix(e.sdp, "a=max-message-size:");
                return i.length > 0 ? r = parseInt(i[0].substr(19), 10) : "firefox" === t.browser && -1 !== n && (r = 2147483637), r
            },
            o = e.RTCPeerConnection.prototype.setRemoteDescription;
        e.RTCPeerConnection.prototype.setRemoteDescription = function () {
            if (this._sctp = null, "chrome" === t.browser && t.version >= 76) {
                const {
                    sdpSemantics: e
                } = this.getConfiguration();
                "plan-b" === e && Object.defineProperty(this, "sctp", {
                    get() {
                        return void 0 === this._sctp ? null : this._sctp
                    }, enumerable: !0, configurable: !0
                })
            }
            if (n(arguments[0])) {
                const e = r(arguments[0]),
                    t = i(e),
                    n = a(arguments[0], e);
                let o;
                o = 0 === t && 0 === n ? Number.POSITIVE_INFINITY : 0 === t || 0 === n ? Math.max(t, n) : Math.min(t, n);
                const s = {};
                Object.defineProperty(s, "maxMessageSize", {
                    get: () => o
                }), this._sctp = s
            }
            return o.apply(this, arguments)
        }
    }

    function rr(e) {
        if (!e.RTCPeerConnection || !("createDataChannel" in e.RTCPeerConnection.prototype)) return;

        function t(e, t) {
            const n = e.send;
            e.send = function () {
                const r = arguments[0],
                    i = r.length || r.size || r.byteLength;
                if ("open" === e.readyState && t.sctp && i > t.sctp.maxMessageSize) throw new TypeError("Message too large (can send a maximum of " + t.sctp.maxMessageSize + " bytes)");
                return n.apply(e, arguments)
            }
        }
        const n = e.RTCPeerConnection.prototype.createDataChannel;
        e.RTCPeerConnection.prototype.createDataChannel = function () {
            const e = n.apply(this, arguments);
            return t(e, this), e
        }, nn(e, "datachannel", e => (t(e.channel, e.target), e))
    }

    function ir(e) {
        if (!e.RTCPeerConnection || "connectionState" in e.RTCPeerConnection.prototype) return;
        const t = e.RTCPeerConnection.prototype;
        Object.defineProperty(t, "connectionState", {
            get() {
                return {
                    completed: "connected",
                    checking: "connecting"
                }[this.iceConnectionState] || this.iceConnectionState
            }, enumerable: !0, configurable: !0
        }), Object.defineProperty(t, "onconnectionstatechange", {
            get() {
                return this._onconnectionstatechange || null
            }, set(e) {
                this._onconnectionstatechange && (this.removeEventListener("connectionstatechange", this._onconnectionstatechange), delete this._onconnectionstatechange), e && this.addEventListener("connectionstatechange", this._onconnectionstatechange = e)
            }, enumerable: !0, configurable: !0
        }), ["setLocalDescription", "setRemoteDescription"].forEach(e => {
            const n = t[e];
            t[e] = function () {
                return this._connectionstatechangepoly || (this._connectionstatechangepoly = e => {
                    const t = e.target;
                    if (t._lastConnectionState !== t.connectionState) {
                        t._lastConnectionState = t.connectionState;
                        const n = new Event("connectionstatechange", e);
                        t.dispatchEvent(n)
                    }
                    return e
                }, this.addEventListener("iceconnectionstatechange", this._connectionstatechangepoly)), n.apply(this, arguments)
            }
        })
    }

    function ar(e, t) {
        if (!e.RTCPeerConnection) return;
        if ("chrome" === t.browser && t.version >= 71) return;
        if ("safari" === t.browser && t.version >= 605) return;
        const n = e.RTCPeerConnection.prototype.setRemoteDescription;
        e.RTCPeerConnection.prototype.setRemoteDescription = function (t) {
            if (t && t.sdp && -1 !== t.sdp.indexOf("\na=extmap-allow-mixed")) {
                const n = t.sdp.split("\n").filter(e => "a=extmap-allow-mixed" !== e.trim()).join("\n");
                e.RTCSessionDescription && t instanceof e.RTCSessionDescription ? arguments[0] = new e.RTCSessionDescription({
                    type: t.type,
                    sdp: n
                }) : t.sdp = n
            }
            return n.apply(this, arguments)
        }
    }

    function or(e, t) {
        if (!e.RTCPeerConnection || !e.RTCPeerConnection.prototype) return;
        const n = e.RTCPeerConnection.prototype.addIceCandidate;
        n && 0 !== n.length && (e.RTCPeerConnection.prototype.addIceCandidate = function () {
            return arguments[0] ? ("chrome" === t.browser && t.version < 78 || "firefox" === t.browser && t.version < 68 || "safari" === t.browser) && arguments[0] && "" === arguments[0].candidate ? Promise.resolve() : n.apply(this, arguments) : (arguments[1] && arguments[1].apply(null), Promise.resolve())
        })
    }
    var sr = Object.freeze({
        __proto__: null,
        shimRTCIceCandidate: tr,
        shimMaxMessageSize: nr,
        shimSendThrowTypeError: rr,
        shimConnectionState: ir,
        removeExtmapAllowMixed: ar,
        shimAddIceCandidateNullOrEmpty: or
    });
    ! function ({
        window: e
    } = {}, t = {
        shimChrome: !0,
        shimFirefox: !0,
        shimEdge: !0,
        shimSafari: !0
    }) {
        const n = on,
            r = function (e) {
                const t = {
                    browser: null,
                    version: null
                };
                if (void 0 === e || !e.navigator) return t.browser = "Not a browser.", t;
                const {
                    navigator: n
                } = e;
                if (n.mozGetUserMedia) t.browser = "firefox", t.version = tn(n.userAgent, /Firefox\/(\d+)\./, 1);
                else if (n.webkitGetUserMedia || !1 === e.isSecureContext && e.webkitRTCPeerConnection && !e.RTCIceGatherer) t.browser = "chrome", t.version = tn(n.userAgent, /Chrom(e|ium)\/(\d+)\./, 2);
                else if (n.mediaDevices && n.userAgent.match(/Edge\/(\d+).(\d+)$/)) t.browser = "edge", t.version = tn(n.userAgent, /Edge\/(\d+).(\d+)$/, 2);
                else {
                    if (!e.RTCPeerConnection || !n.userAgent.match(/AppleWebKit\/(\d+)\./)) return t.browser = "Not a supported browser.", t;
                    t.browser = "safari", t.version = tn(n.userAgent, /AppleWebKit\/(\d+)\./, 1), t.supportsUnifiedPlan = e.RTCRtpTransceiver && "currentDirection" in e.RTCRtpTransceiver.prototype
                }
                return t
            }(e),
            i = {
                browserDetails: r,
                commonShim: sr,
                extractVersion: tn,
                disableLog: rn,
                disableWarnings: an
            };
        switch (r.browser) {
        case "chrome":
            if (!kn || !yn || !t.shimChrome) return n("Chrome shim is not included in this adapter release."), i;
            if (null === r.version) return n("Chrome shim can not determine version, not shimming."), i;
            n("adapter.js shimming chrome."), i.browserShim = kn, or(e, r), hn(e, r), pn(e), yn(e, r), fn(e), Sn(e, r), mn(e), _n(e), vn(e), Tn(e, r), tr(e), ir(e), nr(e, r), rr(e), ar(e, r);
            break;
        case "firefox":
            if (!Wn || !Vn || !t.shimFirefox) return n("Firefox shim is not included in this adapter release."), i;
            n("adapter.js shimming firefox."), i.browserShim = Wn, or(e, r), Mn(e, r), Vn(e, r), Ln(e), jn(e), Un(e), Fn(e), Bn(e), Hn(e), Gn(e), Jn(e), zn(e), tr(e), ir(e), nr(e, r), rr(e);
            break;
        case "edge":
            if (!Nn || !xn || !t.shimEdge) return n("MS edge shim is not included in this adapter release."), i;
            n("adapter.js shimming edge."), i.browserShim = Nn, Pn(e), Dn(e), xn(e, r), On(e), nr(e, r), rr(e);
            break;
        case "safari":
            if (!er || !t.shimSafari) return n("Safari shim is not included in this adapter release."), i;
            n("adapter.js shimming safari."), i.browserShim = er, or(e, r), Xn(e), $n(e), qn(e), shimLocalStreamsAPI(e), shimRemoteStreamsAPI(e), Yn(e), Kn(e), Zn(e), tr(e), nr(e, r), rr(e), ar(e, r);
            break;
        default:
            n("Unsupported browser!")
        }
    }({
        window: "undefined" == typeof window ? void 0 : window
    });
    var cr = [].slice,
        ur = {},
        dr = function (e, t, n) {
            if (!(t in ur)) {
                for (var r = [], i = 0; i < t; i++) r[i] = "a[" + i + "]";
                ur[t] = Function("C,a", "return new C(" + r.join(",") + ")")
            }
            return ur[t](e, n)
        },
        lr = Function.bind || function (e) {
            var t = ne(this),
                n = cr.call(arguments, 1),
                r = function () {
                    var i = n.concat(cr.call(arguments));
                    return this instanceof r ? dr(t, i.length, i) : t.apply(e, i)
                };
            return G(t.prototype) && (r.prototype = t.prototype), r
        };
    Et({
        target: "Function",
        proto: !0
    }, {
        bind: lr
    });
    var hr = Xe.EXISTS,
        pr = we.f,
        fr = Function.prototype,
        mr = fr.toString,
        _r = /^\s*function ([^ (]*)/;
    D && !hr && pr(fr, "name", {
        configurable: !0,
        get: function () {
            try {
                return mr.call(this).match(_r)[1]
            } catch (e) {
                return ""
            }
        }
    });
    var vr, gr = function (e) {
            if ("Symbol" === xt(e)) throw TypeError("Cannot convert a Symbol value to a string");
            return String(e)
        },
        Sr = function () {
            var e = Ie(this),
                t = "";
            return e.global && (t += "g"), e.ignoreCase && (t += "i"), e.multiline && (t += "m"), e.dotAll && (t += "s"), e.unicode && (t += "u"), e.sticky && (t += "y"), t
        },
        yr = A.RegExp,
        Tr = {
            UNSUPPORTED_Y: P((function () {
                var e = yr("a", "y");
                return e.lastIndex = 2, null != e.exec("abcd")
            })),
            BROKEN_CARET: P((function () {
                var e = yr("^r", "gy");
                return e.lastIndex = 2, null != e.exec("str")
            }))
        },
        kr = Object.keys || function (e) {
            return dt(e, lt)
        },
        br = D ? Object.defineProperties : function (e, t) {
            Ie(e);
            for (var n, r = kr(t), i = r.length, a = 0; i > a;) we.f(e, n = r[a++], t[n]);
            return e
        },
        Rr = z("document", "documentElement"),
        Er = Ue("IE_PROTO"),
        Ir = function () {},
        Cr = function (e) {
            return "<script>" + e + "<\/script>"
        },
        wr = function (e) {
            e.write(Cr("")), e.close();
            var t = e.parentWindow.Object;
            return e = null, t
        },
        Ar = function () {
            try {
                vr = new ActiveXObject("htmlfile")
            } catch (r) {}
            var e, t;
            Ar = "undefined" != typeof document ? document.domain && vr ? wr(vr) : ((t = ke("iframe")).style.display = "none", Rr.appendChild(t), t.src = String("javascript:"), (e = t.contentWindow.document).open(), e.write(Cr("document.F=Object")), e.close(), e.F) : wr(vr);
            for (var n = lt.length; n--;) delete Ar.prototype[lt[n]];
            return Ar()
        };
    Fe[Er] = !0;
    var Pr = Object.create || function (e, t) {
            var n;
            return null !== e ? (Ir.prototype = Ie(e), n = new Ir, Ir.prototype = null, n[Er] = e) : n = Ar(), void 0 === t ? n : br(n, t)
        },
        Dr = A.RegExp,
        xr = P((function () {
            var e = Dr(".", "s");
            return !(e.dotAll && e.exec("\n") && "s" === e.flags)
        })),
        Or = A.RegExp,
        Nr = P((function () {
            var e = Or("(?<a>b)", "g");
            return "b" !== e.exec("b").groups.a || "bc" !== "b".replace(e, "$<a>c")
        })),
        Mr = We.get,
        Lr = RegExp.prototype.exec,
        Vr = oe("native-string-replace", String.prototype.replace),
        Ur = Lr,
        Fr = function () {
            var e = /a/,
                t = /b*/g;
            return Lr.call(e, "a"), Lr.call(t, "a"), 0 !== e.lastIndex || 0 !== t.lastIndex
        }(),
        jr = Tr.UNSUPPORTED_Y || Tr.BROKEN_CARET,
        Br = void 0 !== /()??/.exec("")[1];
    (Fr || Br || jr || xr || Nr) && (Ur = function (e) {
        var t, n, r, i, a, o, s, c = this,
            u = Mr(c),
            d = gr(e),
            l = u.raw;
        if (l) return l.lastIndex = c.lastIndex, t = Ur.call(l, d), c.lastIndex = l.lastIndex, t;
        var h = u.groups,
            p = jr && c.sticky,
            f = Sr.call(c),
            m = c.source,
            _ = 0,
            v = d;
        if (p && (-1 === (f = f.replace("y", "")).indexOf("g") && (f += "g"), v = d.slice(c.lastIndex), c.lastIndex > 0 && (!c.multiline || c.multiline && "\n" !== d.charAt(c.lastIndex - 1)) && (m = "(?: " + m + ")", v = " " + v, _++), n = new RegExp("^(?:" + m + ")", f)), Br && (n = new RegExp("^" + m + "$(?!\\s)", f)), Fr && (r = c.lastIndex), i = Lr.call(p ? n : c, v), p ? i ? (i.input = i.input.slice(_), i[0] = i[0].slice(_), i.index = c.lastIndex, c.lastIndex += i[0].length) : c.lastIndex = 0 : Fr && i && (c.lastIndex = c.global ? i.index + i[0].length : r), Br && i && i.length > 1 && Vr.call(i[0], n, (function () {
            for (a = 1; a < arguments.length - 2; a++) void 0 === arguments[a] && (i[a] = void 0)
        })), i && h)
            for (i.groups = o = Pr(null), a = 0; a < h.length; a++) o[(s = h[a])[0]] = i[s[1]];
        return i
    });
    var Hr = Ur;
    Et({
        target: "RegExp",
        proto: !0,
        forced: /./.exec !== Hr
    }, {
        exec: Hr
    });
    var Gr = "\t\n\v\f\r                　\u2028\u2029\ufeff",
        Jr = "[" + Gr + "]",
        zr = RegExp("^" + Jr + Jr + "*"),
        Wr = RegExp(Jr + Jr + "*$"),
        qr = function (e) {
            return function (t) {
                var n = gr(j(t));
                return 1 & e && (n = n.replace(zr, "")), 2 & e && (n = n.replace(Wr, "")), n
            }
        },
        Kr = {
            start: qr(1),
            end: qr(2),
            trim: qr(3)
        },
        Qr = Kr.trim,
        Xr = A.parseFloat,
        Yr = A.Symbol,
        $r = Yr && Yr.iterator,
        Zr = 1 / Xr(Gr + "-0") != -Infinity || $r && !P((function () {
            Xr(Object($r))
        })) ? function (e) {
            var t = Qr(gr(e)),
                n = Xr(t);
            return 0 === n && "-" == t.charAt(0) ? -0 : n
        } : Xr;
    Et({
        global: !0,
        forced: parseFloat != Zr
    }, {
        parseFloat: Zr
    });
    var ei = _e("species"),
        ti = RegExp.prototype,
        ni = function (e, t, n, r) {
            var i = _e(e),
                a = !P((function () {
                    var t = {};
                    return t[i] = function () {
                        return 7
                    }, 7 != "" [e](t)
                })),
                o = a && !P((function () {
                    var t = !1,
                        n = /a/;
                    return "split" === e && ((n = {}).constructor = {}, n.constructor[ei] = function () {
                        return n
                    }, n.flags = "", n[i] = /./ [i]), n.exec = function () {
                        return t = !0, null
                    }, n[i](""), !t
                }));
            if (!a || !o || n) {
                var s = /./ [i],
                    c = t(i, "" [e], (function (e, t, n, r, i) {
                        var o = t.exec;
                        return o === Hr || o === ti.exec ? a && !i ? {
                            done: !0,
                            value: s.call(t, n, r)
                        } : {
                            done: !0,
                            value: e.call(n, t, r)
                        } : {
                            done: !1
                        }
                    }));
                Ye(String.prototype, e, c[0]), Ye(ti, i, c[1])
            }
            r && Ae(ti[i], "sham", !0)
        },
        ri = function (e) {
            return function (t, n) {
                var r, i, a = gr(j(t)),
                    o = et(n),
                    s = a.length;
                return o < 0 || o >= s ? e ? "" : void 0 : (r = a.charCodeAt(o)) < 55296 || r > 56319 || o + 1 === s || (i = a.charCodeAt(o + 1)) < 56320 || i > 57343 ? e ? a.charAt(o) : r : e ? a.slice(o, o + 2) : i - 56320 + (r - 55296 << 10) + 65536
            }
        },
        ii = {
            codeAt: ri(!1),
            charAt: ri(!0)
        },
        ai = ii.charAt,
        oi = function (e, t, n) {
            return t + (n ? ai(e, t).length : 1)
        },
        si = function (e, t) {
            var n = e.exec;
            if (H(n)) {
                var r = n.call(e, t);
                return null !== r && Ie(r), r
            }
            if ("RegExp" === V(e)) return Hr.call(e, t);
            throw TypeError("RegExp#exec called on incompatible receiver")
        };
    ni("match", (function (e, t, n) {
        return [
            function (t) {
                var n = j(this),
                    r = null == t ? void 0 : re(t, e);
                return r ? r.call(t, n) : new RegExp(t)[e](gr(n))
            },
            function (e) {
                var r = Ie(this),
                    i = gr(e),
                    a = n(t, r, i);
                if (a.done) return a.value;
                if (!r.global) return si(r, i);
                var o = r.unicode;
                r.lastIndex = 0;
                for (var s, c = [], u = 0; null !== (s = si(r, i));) {
                    var d = gr(s[0]);
                    c[u] = d, "" === d && (r.lastIndex = oi(i, at(r.lastIndex), o)), u++
                }
                return 0 === u ? null : c
            }
        ]
    }));
    var ci = _e("unscopables"),
        ui = Array.prototype;
    null == ui[ci] && we.f(ui, ci, {
        configurable: !0,
        value: Pr(null)
    });
    var di, li, hi, pi = function (e) {
            ui[ci][e] = !0
        },
        fi = {},
        mi = !P((function () {
            function e() {}
            return e.prototype.constructor = null, Object.getPrototypeOf(new e) !== e.prototype
        })),
        _i = Ue("IE_PROTO"),
        vi = Object.prototype,
        gi = mi ? Object.getPrototypeOf : function (e) {
            var t = se(e);
            if (ue(t, _i)) return t[_i];
            var n = t.constructor;
            return H(n) && t instanceof n ? n.prototype : t instanceof Object ? vi : null
        },
        Si = _e("iterator"),
        yi = !1;
    [].keys && ("next" in (hi = [].keys()) ? (li = gi(gi(hi))) !== Object.prototype && (di = li) : yi = !0), (null == di || P((function () {
        var e = {};
        return di[Si].call(e) !== e
    }))) && (di = {}), H(di[Si]) || Ye(di, Si, (function () {
        return this
    }));
    var Ti = {
            IteratorPrototype: di,
            BUGGY_SAFARI_ITERATORS: yi
        },
        ki = we.f,
        bi = _e("toStringTag"),
        Ri = function (e, t, n) {
            e && !ue(e = n ? e : e.prototype, bi) && ki(e, bi, {
                configurable: !0,
                value: t
            })
        },
        Ei = Ti.IteratorPrototype,
        Ii = function () {
            return this
        },
        Ci = Object.setPrototypeOf || ("__proto__" in {} ? function () {
            var e, t = !1,
                n = {};
            try {
                (e = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__").set).call(n, []), t = n instanceof Array
            } catch (r) {}
            return function (n, r) {
                return Ie(n),
                    function (e) {
                        if ("object" == typeof e || H(e)) return e;
                        throw TypeError("Can't set " + String(e) + " as a prototype")
                    }(r), t ? e.call(n, r) : n.__proto__ = r, n
            }
        }() : void 0),
        wi = Xe.PROPER,
        Ai = Xe.CONFIGURABLE,
        Pi = Ti.IteratorPrototype,
        Di = Ti.BUGGY_SAFARI_ITERATORS,
        xi = _e("iterator"),
        Oi = function () {
            return this
        },
        Ni = function (e, t, n, r, i, a, o) {
            ! function (e, t, n) {
                var r = t + " Iterator";
                e.prototype = Pr(Ei, {
                    next: M(1, n)
                }), Ri(e, r, !1), fi[r] = Ii
            }(n, t, r);
            var s, c, u, d = function (e) {
                    if (e === i && m) return m;
                    if (!Di && e in p) return p[e];
                    switch (e) {
                    case "keys":
                    case "values":
                    case "entries":
                        return function () {
                            return new n(this, e)
                        }
                    }
                    return function () {
                        return new n(this)
                    }
                },
                l = t + " Iterator",
                h = !1,
                p = e.prototype,
                f = p[xi] || p["@@iterator"] || i && p[i],
                m = !Di && f || d(i),
                _ = "Array" == t && p.entries || f;
            if (_ && (s = gi(_.call(new e))) !== Object.prototype && s.next && (gi(s) !== Pi && (Ci ? Ci(s, Pi) : H(s[xi]) || Ye(s, xi, Oi)), Ri(s, l, !0)), wi && "values" == i && f && "values" !== f.name && (Ai ? Ae(p, "name", "values") : (h = !0, m = function () {
                return f.call(this)
            })), i)
                if (c = {
                    values: d("values"),
                    keys: a ? m : d("keys"),
                    entries: d("entries")
                }, o)
                    for (u in c)(Di || h || !(u in p)) && Ye(p, u, c[u]);
                else Et({
                    target: t,
                    proto: !0,
                    forced: Di || h
                }, c);
            return p[xi] !== m && Ye(p, xi, m, {
                name: i
            }), fi[t] = m, c
        },
        Mi = We.set,
        Li = We.getterFor("Array Iterator"),
        Vi = Ni(Array, "Array", (function (e, t) {
            Mi(this, {
                type: "Array Iterator",
                target: B(e),
                index: 0,
                kind: t
            })
        }), (function () {
            var e = Li(this),
                t = e.target,
                n = e.kind,
                r = e.index++;
            return !t || r >= t.length ? (e.target = void 0, {
                value: void 0,
                done: !0
            }) : "keys" == n ? {
                value: r,
                done: !1
            } : "values" == n ? {
                value: t[r],
                done: !1
            } : {
                value: [r, t[r]],
                done: !1
            }
        }), "values");
    fi.Arguments = fi.Array, pi("keys"), pi("values"), pi("entries");
    var Ui = pt.f,
        Fi = {}.toString,
        ji = "object" == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [],
        Bi = {
            f: function (e) {
                return ji && "[object Window]" == Fi.call(e) ? function (e) {
                    try {
                        return Ui(e)
                    } catch (t) {
                        return ji.slice()
                    }
                }(e) : Ui(B(e))
            }
        },
        Hi = !P((function () {
            return Object.isExtensible(Object.preventExtensions({}))
        })),
        Gi = E((function (e) {
            var t = we.f,
                n = !1,
                r = he("meta"),
                i = 0,
                a = Object.isExtensible || function () {
                    return !0
                },
                o = function (e) {
                    t(e, r, {
                        value: {
                            objectID: "O" + i++,
                            weakData: {}
                        }
                    })
                },
                s = e.exports = {
                    enable: function () {
                        s.enable = function () {}, n = !0;
                        var e = pt.f,
                            t = [].splice,
                            i = {};
                        i[r] = 1, e(i).length && (pt.f = function (n) {
                            for (var i = e(n), a = 0, o = i.length; a < o; a++)
                                if (i[a] === r) {
                                    t.call(i, a, 1);
                                    break
                                }
                            return i
                        }, Et({
                            target: "Object",
                            stat: !0,
                            forced: !0
                        }, {
                            getOwnPropertyNames: Bi.f
                        }))
                    }, fastKey: function (e, t) {
                        if (!G(e)) return "symbol" == typeof e ? e : ("string" == typeof e ? "S" : "P") + e;
                        if (!ue(e, r)) {
                            if (!a(e)) return "F";
                            if (!t) return "E";
                            o(e)
                        }
                        return e[r].objectID
                    }, getWeakData: function (e, t) {
                        if (!ue(e, r)) {
                            if (!a(e)) return !0;
                            if (!t) return !1;
                            o(e)
                        }
                        return e[r].weakData
                    }, onFreeze: function (e) {
                        return Hi && n && a(e) && !ue(e, r) && o(e), e
                    }
                };
            Fe[r] = !0
        })),
        Ji = (Gi.enable, Gi.fastKey, Gi.getWeakData, Gi.onFreeze, _e("iterator")),
        zi = Array.prototype,
        Wi = _e("iterator"),
        qi = function (e) {
            if (null != e) return re(e, Wi) || re(e, "@@iterator") || fi[xt(e)]
        },
        Ki = function (e, t, n) {
            var r, i;
            Ie(e);
            try {
                if (!(r = re(e, "return"))) {
                    if ("throw" === t) throw n;
                    return n
                }
                r = r.call(e)
            } catch (a) {
                i = !0, r = a
            }
            if ("throw" === t) throw n;
            if (i) throw r;
            return Ie(r), n
        },
        Qi = function (e, t) {
            this.stopped = e, this.result = t
        },
        Xi = function (e, t, n) {
            var r, i, a, o, s, c, u, d, l = n && n.that,
                h = !(!n || !n.AS_ENTRIES),
                p = !(!n || !n.IS_ITERATOR),
                f = !(!n || !n.INTERRUPTED),
                m = It(t, l, 1 + h + f),
                _ = function (e) {
                    return r && Ki(r, "normal", e), new Qi(!0, e)
                },
                v = function (e) {
                    return h ? (Ie(e), f ? m(e[0], e[1], _) : m(e[0], e[1])) : f ? m(e, _) : m(e)
                };
            if (p) r = e;
            else {
                if (!(i = qi(e))) throw TypeError(String(e) + " is not iterable");
                if (void 0 !== (d = i) && (fi.Array === d || zi[Ji] === d)) {
                    for (a = 0, o = ot(e); o > a; a++)
                        if ((s = v(e[a])) && s instanceof Qi) return s;
                    return new Qi(!1)
                }
                r = function (e, t) {
                    var n = arguments.length < 2 ? qi(e) : t;
                    if (ne(n)) return Ie(n.call(e));
                    throw TypeError(String(e) + " is not iterable")
                }(e, i)
            }
            for (c = r.next; !(u = c.call(r)).done;) {
                try {
                    s = v(u.value)
                } catch (g) {
                    Ki(r, "throw", g)
                }
                if ("object" == typeof s && s && s instanceof Qi) return s
            }
            return new Qi(!1)
        },
        Yi = function (e, t, n) {
            if (e instanceof t) return e;
            throw TypeError("Incorrect " + (n ? n + " " : "") + "invocation")
        },
        $i = _e("iterator"),
        Zi = !1;
    try {
        var ea = 0,
            ta = {
                next: function () {
                        return {
                            done: !!ea++
                        }
                    },
                    return : function () {
                        Zi = !0
                    }
            };
        ta[$i] = function () {
            return this
        }, Array.from(ta, (function () {
            throw 2
        }))
    } catch (GS) {}
    var na = function (e, t) {
            if (!t && !Zi) return !1;
            var n = !1;
            try {
                var r = {};
                r[$i] = function () {
                    return {
                        next: function () {
                            return {
                                done: n = !0
                            }
                        }
                    }
                }, e(r)
            } catch (GS) {}
            return n
        },
        ra = function (e, t, n) {
            var r, i;
            return Ci && H(r = t.constructor) && r !== n && G(i = r.prototype) && i !== n.prototype && Ci(e, i), e
        },
        ia = function (e, t, n) {
            for (var r in t) Ye(e, r, t[r], n);
            return e
        },
        aa = _e("species"),
        oa = function (e) {
            var t = z(e),
                n = we.f;
            D && t && !t[aa] && n(t, aa, {
                configurable: !0,
                get: function () {
                    return this
                }
            })
        },
        sa = we.f,
        ca = Gi.fastKey,
        ua = We.set,
        da = We.getterFor,
        la = (function (e, t, n) {
            var r = -1 !== e.indexOf("Map"),
                i = -1 !== e.indexOf("Weak"),
                a = r ? "set" : "add",
                o = A[e],
                s = o && o.prototype,
                c = o,
                u = {},
                d = function (e) {
                    var t = s[e];
                    Ye(s, e, "add" == e ? function (e) {
                        return t.call(this, 0 === e ? 0 : e), this
                    } : "delete" == e ? function (e) {
                        return !(i && !G(e)) && t.call(this, 0 === e ? 0 : e)
                    } : "get" == e ? function (e) {
                        return i && !G(e) ? void 0 : t.call(this, 0 === e ? 0 : e)
                    } : "has" == e ? function (e) {
                        return !(i && !G(e)) && t.call(this, 0 === e ? 0 : e)
                    } : function (e, n) {
                        return t.call(this, 0 === e ? 0 : e, n), this
                    })
                };
            if (bt(e, !H(o) || !(i || s.forEach && !P((function () {
                (new o).entries().next()
            }))))) c = n.getConstructor(t, e, r, a), Gi.enable();
            else if (bt(e, !0)) {
                var l = new c,
                    h = l[a](i ? {} : -0, 1) != l,
                    p = P((function () {
                        l.has(1)
                    })),
                    f = na((function (e) {
                        new o(e)
                    })),
                    m = !i && P((function () {
                        for (var e = new o, t = 5; t--;) e[a](t, t);
                        return !e.has(-0)
                    }));
                f || ((c = t((function (t, n) {
                    Yi(t, c, e);
                    var i = ra(new o, t, c);
                    return null != n && Xi(n, i[a], {
                        that: i,
                        AS_ENTRIES: r
                    }), i
                }))).prototype = s, s.constructor = c), (p || m) && (d("delete"), d("has"), r && d("get")), (m || h) && d(a), i && s.clear && delete s.clear
            }
            u[e] = c, Et({
                global: !0,
                forced: c != o
            }, u), Ri(c, e), i || n.setStrong(c, e, r)
        }("Map", (function (e) {
            return function () {
                return e(this, arguments.length ? arguments[0] : void 0)
            }
        }), {
            getConstructor: function (e, t, n, r) {
                var i = e((function (e, a) {
                        Yi(e, i, t), ua(e, {
                            type: t,
                            index: Pr(null),
                            first: void 0,
                            last: void 0,
                            size: 0
                        }), D || (e.size = 0), null != a && Xi(a, e[r], {
                            that: e,
                            AS_ENTRIES: n
                        })
                    })),
                    a = da(t),
                    o = function (e, t, n) {
                        var r, i, o = a(e),
                            c = s(e, t);
                        return c ? c.value = n : (o.last = c = {
                            index: i = ca(t, !0),
                            key: t,
                            value: n,
                            previous: r = o.last,
                            next: void 0,
                            removed: !1
                        }, o.first || (o.first = c), r && (r.next = c), D ? o.size++ : e.size++, "F" !== i && (o.index[i] = c)), e
                    },
                    s = function (e, t) {
                        var n, r = a(e),
                            i = ca(t);
                        if ("F" !== i) return r.index[i];
                        for (n = r.first; n; n = n.next)
                            if (n.key == t) return n
                    };
                return ia(i.prototype, {
                    clear: function () {
                        for (var e = a(this), t = e.index, n = e.first; n;) n.removed = !0, n.previous && (n.previous = n.previous.next = void 0), delete t[n.index], n = n.next;
                        e.first = e.last = void 0, D ? e.size = 0 : this.size = 0
                    }, delete: function (e) {
                        var t = a(this),
                            n = s(this, e);
                        if (n) {
                            var r = n.next,
                                i = n.previous;
                            delete t.index[n.index], n.removed = !0, i && (i.next = r), r && (r.previous = i), t.first == n && (t.first = r), t.last == n && (t.last = i), D ? t.size-- : this.size--
                        }
                        return !!n
                    }, forEach: function (e) {
                        for (var t, n = a(this), r = It(e, arguments.length > 1 ? arguments[1] : void 0, 3); t = t ? t.next : n.first;)
                            for (r(t.value, t.key, this); t && t.removed;) t = t.previous
                    }, has: function (e) {
                        return !!s(this, e)
                    }
                }), ia(i.prototype, n ? {
                    get: function (e) {
                        var t = s(this, e);
                        return t && t.value
                    }, set: function (e, t) {
                        return o(this, 0 === e ? 0 : e, t)
                    }
                } : {
                    add: function (e) {
                        return o(this, e = 0 === e ? 0 : e, e)
                    }
                }), D && sa(i.prototype, "size", {
                    get: function () {
                        return a(this).size
                    }
                }), i
            }, setStrong: function (e, t, n) {
                var r = t + " Iterator",
                    i = da(t),
                    a = da(r);
                Ni(e, t, (function (e, t) {
                    ua(this, {
                        type: r,
                        target: e,
                        state: i(e),
                        kind: t,
                        last: void 0
                    })
                }), (function () {
                    for (var e = a(this), t = e.kind, n = e.last; n && n.removed;) n = n.previous;
                    return e.target && (e.last = n = n ? n.next : e.state.first) ? "keys" == t ? {
                        value: n.key,
                        done: !1
                    } : "values" == t ? {
                        value: n.value,
                        done: !1
                    } : {
                        value: [n.key, n.value],
                        done: !1
                    } : (e.target = void 0, {
                        value: void 0,
                        done: !0
                    })
                }), n ? "entries" : "values", !n, !0), oa(t)
            }
        }), At ? {}.toString : function () {
            return "[object " + xt(this) + "]"
        });
    At || Ye(Object.prototype, "toString", la, {
        unsafe: !0
    });
    var ha = ii.charAt,
        pa = We.set,
        fa = We.getterFor("String Iterator");
    Ni(String, "String", (function (e) {
        pa(this, {
            type: "String Iterator",
            string: gr(e),
            index: 0
        })
    }), (function () {
        var e, t = fa(this),
            n = t.string,
            r = t.index;
        return r >= n.length ? {
            value: void 0,
            done: !0
        } : (e = ha(n, r), t.index += e.length, {
            value: e,
            done: !1
        })
    }));
    var ma = {
            CSSRuleList: 0,
            CSSStyleDeclaration: 0,
            CSSValueList: 0,
            ClientRectList: 0,
            DOMRectList: 0,
            DOMStringList: 0,
            DOMTokenList: 1,
            DataTransferItemList: 0,
            FileList: 0,
            HTMLAllCollection: 0,
            HTMLCollection: 0,
            HTMLFormElement: 0,
            HTMLSelectElement: 0,
            MediaList: 0,
            MimeTypeArray: 0,
            NamedNodeMap: 0,
            NodeList: 1,
            PaintRequestList: 0,
            Plugin: 0,
            PluginArray: 0,
            SVGLengthList: 0,
            SVGNumberList: 0,
            SVGPathSegList: 0,
            SVGPointList: 0,
            SVGStringList: 0,
            SVGTransformList: 0,
            SourceBufferList: 0,
            StyleSheetList: 0,
            TextTrackCueList: 0,
            TextTrackList: 0,
            TouchList: 0
        },
        _a = ke("span").classList,
        va = _a && _a.constructor && _a.constructor.prototype,
        ga = va === Object.prototype ? void 0 : va,
        Sa = _e("iterator"),
        ya = _e("toStringTag"),
        Ta = Vi.values,
        ka = function (e, t) {
            if (e) {
                if (e[Sa] !== Ta) try {
                    Ae(e, Sa, Ta)
                } catch (GS) {
                    e[Sa] = Ta
                }
                if (e[ya] || Ae(e, ya, t), ma[t])
                    for (var n in Vi)
                        if (e[n] !== Vi[n]) try {
                            Ae(e, n, Vi[n])
                        } catch (GS) {
                            e[n] = Vi[n]
                        }
            }
        };
    for (var ba in ma) ka(A[ba] && A[ba].prototype, ba);
    ka(ga, "DOMTokenList");
    var Ra = Object.is || function (e, t) {
        return e === t ? 0 !== e || 1 / e == 1 / t : e != e && t != t
    };
    ni("search", (function (e, t, n) {
        return [
            function (t) {
                var n = j(this),
                    r = null == t ? void 0 : re(t, e);
                return r ? r.call(t, n) : new RegExp(t)[e](gr(n))
            },
            function (e) {
                var r = Ie(this),
                    i = gr(e),
                    a = n(t, r, i);
                if (a.done) return a.value;
                var o = r.lastIndex;
                Ra(o, 0) || (r.lastIndex = 0);
                var s = si(r, i);
                return Ra(r.lastIndex, o) || (r.lastIndex = o), null === s ? -1 : s.index
            }
        ]
    }));
    var Ea = _e("match"),
        Ia = function (e) {
            var t;
            return G(e) && (void 0 !== (t = e[Ea]) ? !!t : "RegExp" == V(e))
        },
        Ca = we.f,
        wa = pt.f,
        Aa = We.enforce,
        Pa = _e("match"),
        Da = A.RegExp,
        xa = Da.prototype,
        Oa = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,
        Na = /a/g,
        Ma = /a/g,
        La = new Da(Na) !== Na,
        Va = Tr.UNSUPPORTED_Y,
        Ua = D && (!La || Va || xr || Nr || P((function () {
            return Ma[Pa] = !1, Da(Na) != Na || Da(Ma) == Ma || "/a/i" != Da(Na, "i")
        })));
    if (bt("RegExp", Ua)) {
        for (var Fa = function (e, t) {
            var n, r, i, a, o, s, c = this instanceof Fa,
                u = Ia(e),
                d = void 0 === t,
                l = [],
                h = e;
            if (!c && u && d && e.constructor === Fa) return e;
            if ((u || e instanceof Fa) && (e = e.source, d && (t = "flags" in h ? h.flags : Sr.call(h))), e = void 0 === e ? "" : gr(e), t = void 0 === t ? "" : gr(t), h = e, xr && "dotAll" in Na && (r = !!t && t.indexOf("s") > -1) && (t = t.replace(/s/g, "")), n = t, Va && "sticky" in Na && (i = !!t && t.indexOf("y") > -1) && (t = t.replace(/y/g, "")), Nr && (e = (a = function (e) {
                for (var t, n = e.length, r = 0, i = "", a = [], o = {}, s = !1, c = !1, u = 0, d = ""; r <= n; r++) {
                    if ("\\" === (t = e.charAt(r))) t += e.charAt(++r);
                    else if ("]" === t) s = !1;
                    else if (!s) switch (!0) {
                    case "[" === t:
                        s = !0;
                        break;
                    case "(" === t:
                        Oa.test(e.slice(r + 1)) && (r += 2, c = !0), i += t, u++;
                        continue;
                    case ">" === t && c:
                        if ("" === d || ue(o, d)) throw new SyntaxError("Invalid capture group name");
                        o[d] = !0, a.push([d, u]), c = !1, d = "";
                        continue
                    }
                    c ? d += t : i += t
                }
                return [i, a]
            }(e))[0], l = a[1]), o = ra(Da(e, t), c ? this : xa, Fa), (r || i || l.length) && (s = Aa(o), r && (s.dotAll = !0, s.raw = Fa(function (e) {
                for (var t, n = e.length, r = 0, i = "", a = !1; r <= n; r++) "\\" !== (t = e.charAt(r)) ? a || "." !== t ? ("[" === t ? a = !0 : "]" === t && (a = !1), i += t) : i += "[\\s\\S]" : i += t + e.charAt(++r);
                return i
            }(e), n)), i && (s.sticky = !0), l.length && (s.groups = l)), e !== h) try {
                Ae(o, "source", "" === h ? "(?:)" : h)
            } catch (GS) {}
            return o
        }, ja = function (e) {
            e in Fa || Ca(Fa, e, {
                configurable: !0,
                get: function () {
                    return Da[e]
                }, set: function (t) {
                    Da[e] = t
                }
            })
        }, Ba = wa(Da), Ha = 0; Ba.length > Ha;) ja(Ba[Ha++]);
        xa.constructor = Fa, Fa.prototype = xa, Ye(A, "RegExp", Fa)
    }
    oa("RegExp");
    var Ga = Xe.PROPER,
        Ja = RegExp.prototype,
        za = Ja.toString,
        Wa = P((function () {
            return "/a/b" != za.call({
                source: "a",
                flags: "b"
            })
        })),
        qa = Ga && "toString" != za.name;
    (Wa || qa) && Ye(RegExp.prototype, "toString", (function () {
        var e = Ie(this),
            t = gr(e.source),
            n = e.flags;
        return "/" + t + "/" + gr(void 0 === n && e instanceof RegExp && !("flags" in Ja) ? Sr.call(e) : n)
    }), {
        unsafe: !0
    });
    var Ka = function (e, t) {
            var n = [][e];
            return !!n && P((function () {
                n.call(null, t || function () {
                    throw 1
                }, 1)
            }))
        },
        Qa = ct.indexOf,
        Xa = [].indexOf,
        Ya = !!Xa && 1 / [1].indexOf(1, -0) < 0,
        $a = Ka("indexOf");
    Et({
        target: "Array",
        proto: !0,
        forced: Ya || !$a
    }, {
        indexOf: function (e) {
            return Ya ? Xa.apply(this, arguments) || 0 : Qa(this, e, arguments.length > 1 ? arguments[1] : void 0)
        }
    });
    var Za = Math.floor,
        eo = "".replace,
        to = /\$([$&'`]|\d{1,2}|<[^>]*>)/g,
        no = /\$([$&'`]|\d{1,2})/g,
        ro = function (e, t, n, r, i, a) {
            var o = n + e.length,
                s = r.length,
                c = no;
            return void 0 !== i && (i = se(i), c = to), eo.call(a, c, (function (a, c) {
                var u;
                switch (c.charAt(0)) {
                case "$":
                    return "$";
                case "&":
                    return e;
                case "`":
                    return t.slice(0, n);
                case "'":
                    return t.slice(o);
                case "<":
                    u = i[c.slice(1, -1)];
                    break;
                default:
                    var d = +c;
                    if (0 === d) return a;
                    if (d > s) {
                        var l = Za(d / 10);
                        return 0 === l ? a : l <= s ? void 0 === r[l - 1] ? c.charAt(1) : r[l - 1] + c.charAt(1) : a
                    }
                    u = r[d - 1]
                }
                return void 0 === u ? "" : u
            }))
        },
        io = _e("replace"),
        ao = Math.max,
        oo = Math.min,
        so = "$0" === "a".replace(/./, "$0"),
        co = !!/./ [io] && "" === /./ [io]("a", "$0");
    ni("replace", (function (e, t, n) {
        var r = co ? "$" : "$0";
        return [
            function (e, n) {
                var r = j(this),
                    i = null == e ? void 0 : re(e, io);
                return i ? i.call(e, r, n) : t.call(gr(r), e, n)
            },
            function (e, i) {
                var a = Ie(this),
                    o = gr(e);
                if ("string" == typeof i && -1 === i.indexOf(r) && -1 === i.indexOf("$<")) {
                    var s = n(t, a, o, i);
                    if (s.done) return s.value
                }
                var c = H(i);
                c || (i = gr(i));
                var u = a.global;
                if (u) {
                    var d = a.unicode;
                    a.lastIndex = 0
                }
                for (var l = [];;) {
                    var h = si(a, o);
                    if (null === h) break;
                    if (l.push(h), !u) break;
                    "" === gr(h[0]) && (a.lastIndex = oi(o, at(a.lastIndex), d))
                }
                for (var p, f = "", m = 0, _ = 0; _ < l.length; _++) {
                    h = l[_];
                    for (var v = gr(h[0]), g = ao(oo(et(h.index), o.length), 0), S = [], y = 1; y < h.length; y++) S.push(void 0 === (p = h[y]) ? p : String(p));
                    var T = h.groups;
                    if (c) {
                        var k = [v].concat(S, g, o);
                        void 0 !== T && k.push(T);
                        var b = gr(i.apply(void 0, k))
                    } else b = ro(v, o, g, S, T, i);
                    g >= m && (f += o.slice(m, g) + b, m = g + v.length)
                }
                return f + o.slice(m)
            }
        ]
    }), !!P((function () {
        var e = /./;
        return e.exec = function () {
            var e = [];
            return e.groups = {
                a: "7"
            }, e
        }, "7" !== "".replace(e, "$<a>")
    })) || !so || co);
    var uo = P((function () {
        gi(1)
    }));
    Et({
        target: "Object",
        stat: !0,
        forced: uo,
        sham: !mi
    }, {
        getPrototypeOf: function (e) {
            return gi(se(e))
        }
    });
    var lo = z("Reflect", "apply"),
        ho = Function.apply,
        po = !P((function () {
            lo((function () {}))
        }));
    Et({
        target: "Reflect",
        stat: !0,
        forced: po
    }, {
        apply: function (e, t, n) {
            return ne(e), Ie(n), lo ? lo(e, t, n) : ho.call(e, t, n)
        }
    });
    var fo = function (e, t, n) {
            var r = Se(t);
            r in e ? we.f(e, r, M(0, n)) : e[r] = n
        },
        mo = _e("isConcatSpreadable"),
        _o = Y >= 51 || !P((function () {
            var e = [];
            return e[mo] = !1, e.concat()[0] !== e
        })),
        vo = Wt("concat"),
        go = function (e) {
            if (!G(e)) return !1;
            var t = e[mo];
            return void 0 !== t ? !!t : Ct(e)
        };
    Et({
        target: "Array",
        proto: !0,
        forced: !_o || !vo
    }, {
        concat: function (e) {
            var t, n, r, i, a, o = se(this),
                s = Bt(o, 0),
                c = 0;
            for (t = -1, r = arguments.length; t < r; t++)
                if (go(a = -1 === t ? o : arguments[t])) {
                    if (c + (i = ot(a)) > 9007199254740991) throw TypeError("Maximum allowed index exceeded");
                    for (n = 0; n < i; n++, c++) n in a && fo(s, c, a[n])
                } else {
                    if (c >= 9007199254740991) throw TypeError("Maximum allowed index exceeded");
                    fo(s, c++, a)
                }
            return s.length = c, s
        }
    }), Et({
        target: "Date",
        stat: !0
    }, {
        now: function () {
            return (new Date).getTime()
        }
    });
    var So = Date.prototype,
        yo = So.toString,
        To = So.getTime;
    "Invalid Date" != String(new Date(NaN)) && Ye(So, "toString", (function () {
        var e = To.call(this);
        return e == e ? yo.call(this) : "Invalid Date"
    }));
    var ko = _e("species"),
        bo = function (e, t) {
            var n, r = Ie(e).constructor;
            return void 0 === r || null == (n = Ie(r)[ko]) ? t : function (e) {
                if (Ft(e)) return e;
                throw TypeError(te(e) + " is not a constructor")
            }(n)
        },
        Ro = Tr.UNSUPPORTED_Y,
        Eo = [].push,
        Io = Math.min;
    ni("split", (function (e, t, n) {
        var r;
        return r = "c" == "abbc".split(/(b)*/)[1] || 4 != "test".split(/(?:)/, -1).length || 2 != "ab".split(/(?:ab)*/).length || 4 != ".".split(/(.?)(.?)/).length || ".".split(/()()/).length > 1 || "".split(/.?/).length ? function (e, n) {
            var r = gr(j(this)),
                i = void 0 === n ? 4294967295 : n >>> 0;
            if (0 === i) return [];
            if (void 0 === e) return [r];
            if (!Ia(e)) return t.call(r, e, i);
            for (var a, o, s, c = [], u = (e.ignoreCase ? "i" : "") + (e.multiline ? "m" : "") + (e.unicode ? "u" : "") + (e.sticky ? "y" : ""), d = 0, l = new RegExp(e.source, u + "g");
                (a = Hr.call(l, r)) && !((o = l.lastIndex) > d && (c.push(r.slice(d, a.index)), a.length > 1 && a.index < r.length && Eo.apply(c, a.slice(1)), s = a[0].length, d = o, c.length >= i));) l.lastIndex === a.index && l.lastIndex++;
            return d === r.length ? !s && l.test("") || c.push("") : c.push(r.slice(d)), c.length > i ? c.slice(0, i) : c
        } : "0".split(void 0, 0).length ? function (e, n) {
            return void 0 === e && 0 === n ? [] : t.call(this, e, n)
        } : t, [
            function (t, n) {
                var i = j(this),
                    a = null == t ? void 0 : re(t, e);
                return a ? a.call(t, i, n) : r.call(gr(i), t, n)
            },
            function (e, i) {
                var a = Ie(this),
                    o = gr(e),
                    s = n(r, a, o, i, r !== t);
                if (s.done) return s.value;
                var c = bo(a, RegExp),
                    u = a.unicode,
                    d = (a.ignoreCase ? "i" : "") + (a.multiline ? "m" : "") + (a.unicode ? "u" : "") + (Ro ? "g" : "y"),
                    l = new c(Ro ? "^(?:" + a.source + ")" : a, d),
                    h = void 0 === i ? 4294967295 : i >>> 0;
                if (0 === h) return [];
                if (0 === o.length) return null === si(l, o) ? [o] : [];
                for (var p = 0, f = 0, m = []; f < o.length;) {
                    l.lastIndex = Ro ? 0 : f;
                    var _, v = si(l, Ro ? o.slice(f) : o);
                    if (null === v || (_ = Io(at(l.lastIndex + (Ro ? f : 0)), o.length)) === p) f = oi(o, f, u);
                    else {
                        if (m.push(o.slice(p, f)), m.length === h) return m;
                        for (var g = 1; g <= v.length - 1; g++)
                            if (m.push(v[g]), m.length === h) return m;
                        f = p = _
                    }
                }
                return m.push(o.slice(p)), m
            }
        ]
    }), !!P((function () {
        var e = /(?:)/,
            t = e.exec;
        e.exec = function () {
            return t.apply(this, arguments)
        };
        var n = "ab".split(e);
        return 2 !== n.length || "a" !== n[0] || "b" !== n[1]
    })), Ro);
    var Co = 1..valueOf,
        wo = function (e) {
            return Co.call(e)
        },
        Ao = pt.f,
        Po = Ee.f,
        Do = we.f,
        xo = Kr.trim,
        Oo = A.Number,
        No = Oo.prototype,
        Mo = function (e) {
            var t = ge(e, "number");
            return "bigint" == typeof t ? t : Lo(t)
        },
        Lo = function (e) {
            var t, n, r, i, a, o, s, c, u = ge(e, "number");
            if (ee(u)) throw TypeError("Cannot convert a Symbol value to a number");
            if ("string" == typeof u && u.length > 2)
                if (43 === (t = (u = xo(u)).charCodeAt(0)) || 45 === t) {
                    if (88 === (n = u.charCodeAt(2)) || 120 === n) return NaN
                } else if (48 === t) {
                switch (u.charCodeAt(1)) {
                case 66:
                case 98:
                    r = 2, i = 49;
                    break;
                case 79:
                case 111:
                    r = 8, i = 55;
                    break;
                default:
                    return +u
                }
                for (o = (a = u.slice(2)).length, s = 0; s < o; s++)
                    if ((c = a.charCodeAt(s)) < 48 || c > i) return NaN;
                return parseInt(a, r)
            }
            return +u
        };
    if (bt("Number", !Oo(" 0o1") || !Oo("0b1") || Oo("+0x1"))) {
        for (var Vo, Uo = function (e) {
            var t = arguments.length < 1 ? 0 : Oo(Mo(e)),
                n = this;
            return n instanceof Uo && P((function () {
                wo(n)
            })) ? ra(Object(t), n, Uo) : t
        }, Fo = D ? Ao(Oo) : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","), jo = 0; Fo.length > jo; jo++) ue(Oo, Vo = Fo[jo]) && !ue(Uo, Vo) && Do(Uo, Vo, Po(Oo, Vo));
        Uo.prototype = No, No.constructor = Uo, Ye(A, "Number", Uo)
    }
    var Bo = "wss://qcloud.rtc.qq.com",
        Ho = "wss://bk.rtc.qq.com",
        Go = "wss://trtc.rtc.qq.com",
        Jo = "wss://webrtc.qq.com",
        zo = "",
        Wo = function (e) {
            return zo = e
        },
        qo = 1,
        Ko = 2,
        Qo = 20,
        Xo = 21,
        Yo = "5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV",
        $o = "224d130c-7b5c-415b-aaa2-79c2eb5a6df2",
        Zo = 2,
        es = "DISCONNECTED",
        ts = "CONNECTING",
        ns = "RECONNECTING",
        rs = "CONNECTED",
        is = "join",
        as = "delta-join",
        os = "rejoin",
        ss = "leave",
        cs = "delta-leave",
        us = "publish",
        ds = "delta-publish",
        ls = "unpublish",
        hs = "subscribe",
        ps = "unsubscribe",
        fs = "uplink-connection",
        ms = "uplink-reconnection",
        _s = "downlink-connection",
        vs = "downlink-reconnection",
        gs = "setLocalDescription",
        Ss = "setRemoteDescription",
        ys = "iceConnectionState",
        Ts = "stream-initialize",
        ks = "websocketConnectionState",
        bs = "websocketReconnectionState",
        Rs = "update-stream",
        Es = "recover-subscription",
        Is = "start-mix-transcode",
        Cs = "stop-mix-transcode",
        ws = "player-error",
        As = "unsubscribe",
        Ps = "subscribe_change",
        Ds = {
            MANUAL: "manual",
            PRESET_LAYOUT: "preset-layout"
        },
        xs = {
            REMOTE: "$PLACE_HOLDER_REMOTE$"
        },
        Os = {
            IT_AUDIO_VIDEO: 0,
            IT_PICTURE: 2,
            IT_CANVAS: 3,
            IT_PURE_AUDIO: 4,
            IT_PURE_VIDEO: 5
        },
        Ns = "string",
        Ms = "number",
        Ls = "boolean",
        Vs = "array",
        Us = "object",
        Fs = "audio",
        js = "video",
        Bs = "auxiliary",
        Hs = "user",
        Gs = "environment",
        Js = "add",
        zs = "remove",
        Ws = {
            unknown: 0,
            wifi: 1,
            "3g": 2,
            "2g": 3,
            "4g": 4,
            wired: 5
        },
        qs = -1,
        Ks = 0,
        Qs = 1,
        Xs = "https://schedule.rtc.qq.com/api/v1/config",
        Ys = "TRTC",
        $s = "Client",
        Zs = "LocalStream",
        ec = "RemoteStream",
        tc = "Stream",
        nc = "https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/",
        rc = {
            INVALID_PARAMETER: 4096,
            INVALID_OPERATION: 4097,
            NOT_SUPPORTED: 4098,
            DEVICE_NOT_FOUND: 4099,
            SIGNAL_CHANNEL_SETUP_FAILED: 16385,
            SIGNAL_CHANNEL_ERROR: 16386,
            ICE_TRANSPORT_ERROR: 16387,
            JOIN_ROOM_FAILED: 16388,
            CREATE_OFFER_FAILED: 16389,
            SIGNAL_CHANNEL_RECONNECTION_FAILED: 16390,
            UPLINK_RECONNECTION_FAILED: 16391,
            DOWNLINK_RECONNECTION_FAILED: 16392,
            CLIENT_BANNED: 16448,
            SERVER_TIMEOUT: 16449,
            SUBSCRIPTION_TIMEOUT: 16450,
            PLAY_NOT_ALLOWED: 16451,
            DEVICE_AUTO_RECOVER_FAILED: 16452,
            START_PUBLISH_CDN_FAILED: 16453,
            STOP_PUBLISH_CDN_FAILED: 16454,
            START_MIX_TRANSCODE_FAILED: 16455,
            STOP_MIX_TRANSCODE_FAILED: 16456,
            NOT_SUPPORTED_H264: 16457,
            SWITCH_ROLE_FAILED: 16458,
            API_CALL_TIMEOUT: 16459,
            UNKNOWN: 65535
        },
        ic = function (e) {
            u(n, e);
            var t = _(n);

            function n(e) {
                var r, i = e.message,
                    o = e.code,
                    s = void 0 === o ? rc.UNKNOWN : o,
                    c = e.extraCode,
                    u = void 0 === c ? 0 : c;
                return a(this, n), (r = t.call(this, i + " <".concat(function (e) {
                    for (var t in rc)
                        if (rc[t] === e) return t;
                    return "UNKNOWN"
                }(s), " 0x").concat(s.toString(16), ">"))).code_ = s, r.extraCode_ = u, r.name = "RtcError", r.message_ = i, r
            }
            return s(n, [{
                key: "getCode",
                value: function () {
                    return this.code_
                }
            }, {
                key: "getExtraCode",
                value: function () {
                    return this.extraCode_
                }
            }]), n
        }(f(Error)),
        ac = function (e, t) {
            return function () {
                for (var n = new Array(arguments.length), r = 0; r < n.length; r++) n[r] = arguments[r];
                return e.apply(t, n)
            }
        },
        oc = Object.prototype.toString;

    function sc(e) {
        return "[object Array]" === oc.call(e)
    }

    function cc(e) {
        return void 0 === e
    }

    function uc(e) {
        return null !== e && "object" == typeof e
    }

    function dc(e) {
        return "[object Function]" === oc.call(e)
    }

    function lc(e, t) {
        if (null != e)
            if ("object" != typeof e && (e = [e]), sc(e))
                for (var n = 0, r = e.length; n < r; n++) t.call(null, e[n], n, e);
            else
                for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && t.call(null, e[i], i, e)
    }
    var hc = {
        isArray: sc,
        isArrayBuffer: function (e) {
            return "[object ArrayBuffer]" === oc.call(e)
        }, isBuffer: function (e) {
            return null !== e && !cc(e) && null !== e.constructor && !cc(e.constructor) && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e)
        }, isFormData: function (e) {
            return "undefined" != typeof FormData && e instanceof FormData
        }, isArrayBufferView: function (e) {
            return "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && e.buffer instanceof ArrayBuffer
        }, isString: function (e) {
            return "string" == typeof e
        }, isNumber: function (e) {
            return "number" == typeof e
        }, isObject: uc,
        isUndefined: cc,
        isDate: function (e) {
            return "[object Date]" === oc.call(e)
        }, isFile: function (e) {
            return "[object File]" === oc.call(e)
        }, isBlob: function (e) {
            return "[object Blob]" === oc.call(e)
        }, isFunction: dc,
        isStream: function (e) {
            return uc(e) && dc(e.pipe)
        }, isURLSearchParams: function (e) {
            return "undefined" != typeof URLSearchParams && e instanceof URLSearchParams
        }, isStandardBrowserEnv: function () {
            return ("undefined" == typeof navigator || "ReactNative" !== navigator.product && "NativeScript" !== navigator.product && "NS" !== navigator.product) && ("undefined" != typeof window && "undefined" != typeof document)
        }, forEach: lc,
        merge: function e() {
            var t = {};

            function n(n, r) {
                "object" == typeof t[r] && "object" == typeof n ? t[r] = e(t[r], n) : t[r] = n
            }
            for (var r = 0, i = arguments.length; r < i; r++) lc(arguments[r], n);
            return t
        }, deepMerge: function e() {
            var t = {};

            function n(n, r) {
                "object" == typeof t[r] && "object" == typeof n ? t[r] = e(t[r], n) : t[r] = "object" == typeof n ? e({}, n) : n
            }
            for (var r = 0, i = arguments.length; r < i; r++) lc(arguments[r], n);
            return t
        }, extend: function (e, t, n) {
            return lc(t, (function (t, r) {
                e[r] = n && "function" == typeof t ? ac(t, n) : t
            })), e
        }, trim: function (e) {
            return e.replace(/^\s*/, "").replace(/\s*$/, "")
        }
    };

    function pc(e) {
        return encodeURIComponent(e).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]")
    }
    var fc = function (e, t, n) {
        if (!t) return e;
        var r;
        if (n) r = n(t);
        else if (hc.isURLSearchParams(t)) r = t.toString();
        else {
            var i = [];
            hc.forEach(t, (function (e, t) {
                null != e && (hc.isArray(e) ? t += "[]" : e = [e], hc.forEach(e, (function (e) {
                    hc.isDate(e) ? e = e.toISOString() : hc.isObject(e) && (e = JSON.stringify(e)), i.push(pc(t) + "=" + pc(e))
                })))
            })), r = i.join("&")
        } if (r) {
            var a = e.indexOf("#"); - 1 !== a && (e = e.slice(0, a)), e += (-1 === e.indexOf("?") ? "?" : "&") + r
        }
        return e
    };

    function mc() {
        this.handlers = []
    }
    mc.prototype.use = function (e, t) {
        return this.handlers.push({
            fulfilled: e,
            rejected: t
        }), this.handlers.length - 1
    }, mc.prototype.eject = function (e) {
        this.handlers[e] && (this.handlers[e] = null)
    }, mc.prototype.forEach = function (e) {
        hc.forEach(this.handlers, (function (t) {
            null !== t && e(t)
        }))
    };
    var _c = mc,
        vc = function (e, t, n) {
            return hc.forEach(n, (function (n) {
                e = n(e, t)
            })), e
        },
        gc = function (e) {
            return !(!e || !e.__CANCEL__)
        },
        Sc = "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {};

    function yc() {
        throw new Error("setTimeout has not been defined")
    }

    function Tc() {
        throw new Error("clearTimeout has not been defined")
    }
    var kc = yc,
        bc = Tc;

    function Rc(e) {
        if (kc === setTimeout) return setTimeout(e, 0);
        if ((kc === yc || !kc) && setTimeout) return kc = setTimeout, setTimeout(e, 0);
        try {
            return kc(e, 0)
        } catch (t) {
            try {
                return kc.call(null, e, 0)
            } catch (t) {
                return kc.call(this, e, 0)
            }
        }
    }
    "function" == typeof Sc.setTimeout && (kc = setTimeout), "function" == typeof Sc.clearTimeout && (bc = clearTimeout);
    var Ec, Ic = [],
        Cc = !1,
        wc = -1;

    function Ac() {
        Cc && Ec && (Cc = !1, Ec.length ? Ic = Ec.concat(Ic) : wc = -1, Ic.length && Pc())
    }

    function Pc() {
        if (!Cc) {
            var e = Rc(Ac);
            Cc = !0;
            for (var t = Ic.length; t;) {
                for (Ec = Ic, Ic = []; ++wc < t;) Ec && Ec[wc].run();
                wc = -1, t = Ic.length
            }
            Ec = null, Cc = !1,
                function (e) {
                    if (bc === clearTimeout) return clearTimeout(e);
                    if ((bc === Tc || !bc) && clearTimeout) return bc = clearTimeout, clearTimeout(e);
                    try {
                        bc(e)
                    } catch (t) {
                        try {
                            return bc.call(null, e)
                        } catch (t) {
                            return bc.call(this, e)
                        }
                    }
                }(e)
        }
    }

    function Dc(e, t) {
        this.fun = e, this.array = t
    }
    Dc.prototype.run = function () {
        this.fun.apply(null, this.array)
    };

    function xc() {}
    var Oc = xc,
        Nc = xc,
        Mc = xc,
        Lc = xc,
        Vc = xc,
        Uc = xc,
        Fc = xc;
    var jc = Sc.performance || {},
        Bc = jc.now || jc.mozNow || jc.msNow || jc.oNow || jc.webkitNow || function () {
            return (new Date).getTime()
        };
    var Hc = new Date;
    var Gc = {
            nextTick: function (e) {
                var t = new Array(arguments.length - 1);
                if (arguments.length > 1)
                    for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
                Ic.push(new Dc(e, t)), 1 !== Ic.length || Cc || Rc(Pc)
            }, title: "browser",
            browser: !0,
            env: {},
            argv: [],
            version: "",
            versions: {},
            on: Oc,
            addListener: Nc,
            once: Mc,
            off: Lc,
            removeListener: Vc,
            removeAllListeners: Uc,
            emit: Fc,
            binding: function (e) {
                throw new Error("process.binding is not supported")
            }, cwd: function () {
                return "/"
            }, chdir: function (e) {
                throw new Error("process.chdir is not supported")
            }, umask: function () {
                return 0
            }, hrtime: function (e) {
                var t = .001 * Bc.call(jc),
                    n = Math.floor(t),
                    r = Math.floor(t % 1 * 1e9);
                return e && (n -= e[0], (r -= e[1]) < 0 && (n--, r += 1e9)), [n, r]
            }, platform: "browser",
            release: {},
            config: {},
            uptime: function () {
                return (new Date - Hc) / 1e3
            }
        },
        Jc = function (e, t) {
            hc.forEach(e, (function (n, r) {
                r !== t && r.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[r])
            }))
        },
        zc = function (e, t, n, r, i) {
            return function (e, t, n, r, i) {
                return e.config = t, n && (e.code = n), e.request = r, e.response = i, e.isAxiosError = !0, e.toJSON = function () {
                    return {
                        message: this.message,
                        name: this.name,
                        description: this.description,
                        number: this.number,
                        fileName: this.fileName,
                        lineNumber: this.lineNumber,
                        columnNumber: this.columnNumber,
                        stack: this.stack,
                        config: this.config,
                        code: this.code
                    }
                }, e
            }(new Error(e), t, n, r, i)
        },
        Wc = ["age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent"],
        qc = hc.isStandardBrowserEnv() ? function () {
            var e, t = /(msie|trident)/i.test(navigator.userAgent),
                n = document.createElement("a");

            function r(e) {
                var r = e;
                return t && (n.setAttribute("href", r), r = n.href), n.setAttribute("href", r), {
                    href: n.href,
                    protocol: n.protocol ? n.protocol.replace(/:$/, "") : "",
                    host: n.host,
                    search: n.search ? n.search.replace(/^\?/, "") : "",
                    hash: n.hash ? n.hash.replace(/^#/, "") : "",
                    hostname: n.hostname,
                    port: n.port,
                    pathname: "/" === n.pathname.charAt(0) ? n.pathname : "/" + n.pathname
                }
            }
            return e = r(window.location.href),
                function (t) {
                    var n = hc.isString(t) ? r(t) : t;
                    return n.protocol === e.protocol && n.host === e.host
                }
        }() : function () {
            return !0
        },
        Kc = hc.isStandardBrowserEnv() ? {
            write: function (e, t, n, r, i, a) {
                var o = [];
                o.push(e + "=" + encodeURIComponent(t)), hc.isNumber(n) && o.push("expires=" + new Date(n).toGMTString()), hc.isString(r) && o.push("path=" + r), hc.isString(i) && o.push("domain=" + i), !0 === a && o.push("secure"), document.cookie = o.join("; ")
            }, read: function (e) {
                var t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
                return t ? decodeURIComponent(t[3]) : null
            }, remove: function (e) {
                this.write(e, "", Date.now() - 864e5)
            }
        } : {
            write: function () {}, read: function () {
                return null
            }, remove: function () {}
        },
        Qc = function (e) {
            return new Promise((function (t, n) {
                if (e.data.includes('disconnected')) {
                    //console.log('trtc已掉线')
                    //if (document.getElementById('header-trtcstatus')) {
                    //    document.getElementById('header-trtcstatus').innerHTML = '掉线'
                    //    document.getElementById('header-trtcstatus').style.background = 'red'
                    //    document.getElementById('trtcNotice').innerHTML = '[' + new Date().Format("yyyy-MM-dd hh:mm:ss") + '] trtc正在重连...'
                    //}
                }
                var r = e.data,
                    i = e.headers;
                hc.isFormData(r) && delete i["Content-Type"];
                var a = new XMLHttpRequest;
                if (e.auth) {
                    var o = e.auth.username || "",
                        s = e.auth.password || "";
                    i.Authorization = "Basic " + btoa(o + ":" + s)
                }
                var c, u, d = (c = e.baseURL, u = e.url, c && !/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(u) ? function (e, t) {
                    return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e
                }(c, u) : u);
                if (a.open(e.method.toUpperCase(), fc(d, e.params, e.paramsSerializer), !0), a.timeout = e.timeout, a.onreadystatechange = function () {
                    if (a && 4 === a.readyState && (0 !== a.status || a.responseURL && 0 === a.responseURL.indexOf("file:"))) {
                        var r = "getAllResponseHeaders" in a ? function (e) {
                                var t, n, r, i = {};
                                return e ? (hc.forEach(e.split("\n"), (function (e) {
                                    if (r = e.indexOf(":"), t = hc.trim(e.substr(0, r)).toLowerCase(), n = hc.trim(e.substr(r + 1)), t) {
                                        if (i[t] && Wc.indexOf(t) >= 0) return;
                                        i[t] = "set-cookie" === t ? (i[t] ? i[t] : []).concat([n]) : i[t] ? i[t] + ", " + n : n
                                    }
                                })), i) : i
                            }(a.getAllResponseHeaders()) : null,
                            i = {
                                data: e.responseType && "text" !== e.responseType ? a.response : a.responseText,
                                status: a.status,
                                statusText: a.statusText,
                                headers: r,
                                config: e,
                                request: a
                            };
                        ! function (e, t, n) {
                            var r = n.config.validateStatus;
                            !r || r(n.status) ? e(n) : t(zc("Request failed with status code " + n.status, n.config, null, n.request, n))
                        }(t, n, i), a = null
                    }
                }, a.onabort = function () {
                    a && (n(zc("Request aborted", e, "ECONNABORTED", a)), a = null)
                }, a.onerror = function () {
                    n(zc("Network Error", e, null, a)), a = null
                }, a.ontimeout = function () {
                    var t = "timeout of " + e.timeout + "ms exceeded";
                    e.timeoutErrorMessage && (t = e.timeoutErrorMessage), n(zc(t, e, "ECONNABORTED", a)), a = null
                }, hc.isStandardBrowserEnv()) {
                    var l = Kc,
                        h = (e.withCredentials || qc(d)) && e.xsrfCookieName ? l.read(e.xsrfCookieName) : void 0;
                    h && (i[e.xsrfHeaderName] = h)
                }
                if ("setRequestHeader" in a && hc.forEach(i, (function (e, t) {
                    void 0 === r && "content-type" === t.toLowerCase() ? delete i[t] : a.setRequestHeader(t, e)
                })), hc.isUndefined(e.withCredentials) || (a.withCredentials = !!e.withCredentials), e.responseType) try {
                    a.responseType = e.responseType
                } catch (p) {
                    if ("json" !== e.responseType) throw p
                }
                "function" == typeof e.onDownloadProgress && a.addEventListener("progress", e.onDownloadProgress), "function" == typeof e.onUploadProgress && a.upload && a.upload.addEventListener("progress", e.onUploadProgress), e.cancelToken && e.cancelToken.promise.then((function (e) {
                    a && (a.abort(), n(e), a = null)
                })), void 0 === r && (r = null),a.send(r)}))
        },
        Xc = {
            "Content-Type": "application/x-www-form-urlencoded"
        };

    function Yc(e, t) {
        !hc.isUndefined(e) && hc.isUndefined(e["Content-Type"]) && (e["Content-Type"] = t)
    }
    var $c = {
        adapter: function () {
            var e;
            return ("undefined" != typeof XMLHttpRequest || void 0 !== Gc && "[object process]" === Object.prototype.toString.call(Gc)) && (e = Qc), e
        }(),
        transformRequest: [
            function (e, t) {
                return Jc(t, "Accept"), Jc(t, "Content-Type"), hc.isFormData(e) || hc.isArrayBuffer(e) || hc.isBuffer(e) || hc.isStream(e) || hc.isFile(e) || hc.isBlob(e) ? e : hc.isArrayBufferView(e) ? e.buffer : hc.isURLSearchParams(e) ? (Yc(t, "application/x-www-form-urlencoded;charset=utf-8"), e.toString()) : hc.isObject(e) ? (Yc(t, "application/json;charset=utf-8"), JSON.stringify(e)) : e
            }
        ],
        transformResponse: [
            function (e) {
                if ("string" == typeof e) try {
                    e = JSON.parse(e)
                } catch (t) {}
                return e
            }
        ],
        timeout: 0,
        xsrfCookieName: "XSRF-TOKEN",
        xsrfHeaderName: "X-XSRF-TOKEN",
        maxContentLength: -1,
        validateStatus: function (e) {
            return e >= 200 && e < 300
        }, headers: {
            common: {
                Accept: "application/json, text/plain, */*"
            }
        }
    };
    hc.forEach(["delete", "get", "head"], (function (e) {
        $c.headers[e] = {}
    })), hc.forEach(["post", "put", "patch"], (function (e) {
        $c.headers[e] = hc.merge(Xc)
    }));
    var Zc = $c;

    function eu(e) {
        e.cancelToken && e.cancelToken.throwIfRequested()
    }
    var tu = function (e) {
            return eu(e), e.headers = e.headers || {}, e.data = vc(e.data, e.headers, e.transformRequest), e.headers = hc.merge(e.headers.common || {}, e.headers[e.method] || {}, e.headers), hc.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (function (t) {
                delete e.headers[t]
            })), (e.adapter || Zc.adapter)(e).then((function (t) {
                return eu(e), t.data = vc(t.data, t.headers, e.transformResponse), t
            }), (function (t) {
                return gc(t) || (eu(e), t && t.response && (t.response.data = vc(t.response.data, t.response.headers, e.transformResponse))), Promise.reject(t)
            }))
        },
        nu = function (e, t) {
            t = t || {};
            var n = {},
                r = ["url", "method", "params", "data"],
                i = ["headers", "auth", "proxy"],
                a = ["baseURL", "url", "transformRequest", "transformResponse", "paramsSerializer", "timeout", "withCredentials", "adapter", "responseType", "xsrfCookieName", "xsrfHeaderName", "onUploadProgress", "onDownloadProgress", "maxContentLength", "validateStatus", "maxRedirects", "httpAgent", "httpsAgent", "cancelToken", "socketPath"];
            hc.forEach(r, (function (e) {
                void 0 !== t[e] && (n[e] = t[e])
            })), hc.forEach(i, (function (r) {
                hc.isObject(t[r]) ? n[r] = hc.deepMerge(e[r], t[r]) : void 0 !== t[r] ? n[r] = t[r] : hc.isObject(e[r]) ? n[r] = hc.deepMerge(e[r]) : void 0 !== e[r] && (n[r] = e[r])
            })), hc.forEach(a, (function (r) {
                void 0 !== t[r] ? n[r] = t[r] : void 0 !== e[r] && (n[r] = e[r])
            }));
            var o = r.concat(i).concat(a),
                s = Object.keys(t).filter((function (e) {
                    return -1 === o.indexOf(e)
                }));
            return hc.forEach(s, (function (r) {
                void 0 !== t[r] ? n[r] = t[r] : void 0 !== e[r] && (n[r] = e[r])
            })), n
        };

    function ru(e) {
        this.defaults = e, this.interceptors = {
            request: new _c,
            response: new _c
        }
    }
    ru.prototype.request = function (e) {
        "string" == typeof e ? (e = arguments[1] || {}).url = arguments[0] : e = e || {}, (e = nu(this.defaults, e)).method ? e.method = e.method.toLowerCase() : this.defaults.method ? e.method = this.defaults.method.toLowerCase() : e.method = "get";
        var t = [tu, void 0],
            n = Promise.resolve(e);
        for (this.interceptors.request.forEach((function (e) {
            t.unshift(e.fulfilled, e.rejected)
        })), this.interceptors.response.forEach((function (e) {
            t.push(e.fulfilled, e.rejected)
        })); t.length;) n = n.then(t.shift(), t.shift());
        return n
    }, ru.prototype.getUri = function (e) {
        return e = nu(this.defaults, e), fc(e.url, e.params, e.paramsSerializer).replace(/^\?/, "")
    }, hc.forEach(["delete", "get", "head", "options"], (function (e) {
        ru.prototype[e] = function (t, n) {
            return this.request(hc.merge(n || {}, {
                method: e,
                url: t
            }))
        }
    })), hc.forEach(["post", "put", "patch"], (function (e) {
        ru.prototype[e] = function (t, n, r) {
            return this.request(hc.merge(r || {}, {
                method: e,
                url: t,
                data: n
            }))
        }
    }));
    var iu = ru;

    function au(e) {
        this.message = e
    }
    au.prototype.toString = function () {
        return "Cancel" + (this.message ? ": " + this.message : "")
    }, au.prototype.__CANCEL__ = !0;
    var ou = au;

    function su(e) {
        if ("function" != typeof e) throw new TypeError("executor must be a function.");
        var t;
        this.promise = new Promise((function (e) {
            t = e
        }));
        var n = this;
        e((function (e) {
            n.reason || (n.reason = new ou(e), t(n.reason))
        }))
    }
    su.prototype.throwIfRequested = function () {
        if (this.reason) throw this.reason
    }, su.source = function () {
        var e;
        return {
            token: new su((function (t) {
                e = t
            })),
            cancel: e
        }
    };
    var cu = su;

    function uu(e) {
        var t = new iu(e),
            n = ac(iu.prototype.request, t);
        return hc.extend(n, iu.prototype, t), hc.extend(n, t), n
    }
    var du = uu(Zc);
    du.Axios = iu, du.create = function (e) {
        return uu(nu(du.defaults, e))
    }, du.Cancel = ou, du.CancelToken = cu, du.isCancel = gc, du.all = function (e) {
        return Promise.all(e)
    }, du.spread = function (e) {
        return function (t) {
            return e.apply(null, t)
        }
    };
    var lu = du,
        hu = du;
    lu.default = hu;
    var pu = lu,
        fu = ((new Date).getTime(), 0),
        mu = function () {
            return (new Date).getTime() + fu
        },
        _u = function () {
            var e = new Date;
            return e.setTime(mu()), e.toLocaleString()
        },
        vu = {
            sdkAppId: "",
            userId: "",
            version: "",
            env: "qcloud",
            browserVersion: "",
            ua: ""
        },
        gu = function (e) {
            var t = qd(),
                n = t.name,
                r = t.version;
            vu.sdkAppId = "".concat(e.sdkAppId), vu.version = "".concat(e.version), vu.env = e.env, vu.userId = e.userId, vu.browserVersion = n + r, vu.ua = navigator.userAgent
        },
        Su = function (e, t) {
            var n = {
                timestamp: _u(),
                sdkAppId: vu.sdkAppId,
                userId: vu.userId,
                version: vu.version,
                log: e
            };
            t && (n.errorInfo = t.message), pu.post(Eu(), JSON.stringify(n)).catch((function () {}))
        },
        yu = function (e) {
            var t = "stat-".concat(e.eventType, "-").concat(e.result);
            "delta-join" !== e.eventType && "delta-leave" !== e.eventType && "delta-publish" !== e.eventType || (t = "".concat(e.eventType, ":").concat(e.delta)), Su(t), "failed" === e.result && (t = "stat-".concat(e.eventType, "-").concat(e.result, "-").concat(e.code), Su(t, e.error))
        },
        Tu = function (e) {
            if (!Jd) {
                var n = t(t({}, e), vu);
                Du(n.code) && (n.code = "failed" === n.result ? rc.UNKNOWN : 0), pu.post(Iu(), JSON.stringify(n)).catch((function () {}))
            }
        },
        ku = function (e) {
            Jd || (Tu(t(t({}, e), {}, {
                result: "success"
            })), "qcloud" === vu.env && yu(t(t({}, e), {}, {
                result: "success"
            })))
        },
        bu = function (e) {
            if (!Jd) {
                var n = e.eventType,
                    r = e.code,
                    i = e.error,
                    a = {
                        eventType: n,
                        result: "failed",
                        code: r || (i instanceof ic ? i.getExtraCode() || i.getCode() : rc.UNKNOWN)
                    };
                Tu(a), "qcloud" === vu.env && yu(t(t({}, a), {}, {
                    error: i
                }))
            }
        },
        Ru = function () {
            return function (e) {
                var t = window.location.search.match(new RegExp("(\\?|&)" + e + "=([^&]*)(&|$)"));
                return t ? decodeURIComponent(t[2]) : ""
            }("trtc_env")
        },
        Eu = function () {
            return "".concat(zo || "https://yun.tim.qq.com", "/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_log")
        },
        Iu = function () {
            return "".concat(zo || "https://yun.tim.qq.com", "/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_event")
        };

    function Cu() {
        var e = navigator.userAgent,
            t = navigator.connection,
            n = e.match(/NetType\/\w+/) ? e.match(/NetType\/\w+/)[0] : "";
        "3gnet" === (n = n.toLowerCase().replace("nettype/", "")) && (n = "3g");
        var r = t && t.type && t.type.toLowerCase(),
            i = t && t.effectiveType && t.effectiveType.toLowerCase();
        "slow-2" === i && (i = "2g");
        var a = n || "unknown";
        if (r) switch (r) {
        case "cellular":
        case "wimax":
            a = i || "unknown";
            break;
        case "wifi":
            a = "wifi";
            break;
        case "ethernet":
            a = "wired";
            break;
        case "none":
        case "other":
        case "unknown":
            a = "unknown"
        }
        return Kd.info("networkType:", a), a
    }
    var wu = function (e) {
        if (!e || "object" !== n(e) || "[object Object]" != Object.prototype.toString.call(e)) return !1;
        var t = Object.getPrototypeOf(e);
        if (null === t) return !0;
        var r = Object.prototype.hasOwnProperty.call(t, "constructor") && t.constructor;
        return "function" == typeof r && r instanceof r && Function.prototype.toString.call(r) === Function.prototype.toString.call(Object)
    };

    function Au(e) {
        var t = Math.round(e / 2) + 1;
        return t > 6 ? 13e3 : 1e3 * function e(t) {
            var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1,
                r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1;
            return t <= 1 ? r : e(t - 1, r, n + r)
        }(t)
    }
    var Pu = function (e) {
            return "function" == typeof e
        },
        Du = function (e) {
            return void 0 === e
        },
        xu = function (e) {
            return "string" == typeof e
        },
        Ou = function (e) {
            return "number" == typeof e
        };

    function Nu(e) {
        return Reflect.apply(Object.prototype.toString, e, []).replace(/^\[object\s(\w+)\]$/, "$1").toLowerCase()
    }

    function Mu(e, t) {
        for (var n in e)
            if (t[n] && "undefined" !== Nu(e[n]) && Nu(e[n]) !== t[n].toLowerCase()) return {
                ret: !1,
                message: "".concat(n, " should be ").concat(t[n])
            };
        return {
            ret: !0
        }
    }

    function Lu(e) {
        var t = {};
        return t.urls = "turn:".concat(e.url), Du(e.username) || Du(e.credential) || (t.username = e.username, t.credential = e.credential, t.credentialType = "password", Du(e.credentialType) || (t.credentialType = e.credentialType)), t
    }

    function Vu() {
        return performance && performance.now ? Math.floor(performance.now()) : Date.now()
    }

    function Uu(e) {
        var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "big";
        if (!xu(e)) return 0;
        var n = e.split(".");
        return "big" === t ? (Number(n[0]) << 24 | Number(n[1]) << 16 | Number(n[2]) << 8 | Number(n[3])) >>> 0 : (Number(n[3]) << 24 | Number(n[2]) << 16 | Number(n[1]) << 8 | Number(n[0])) >>> 0
    }

    function Fu(e) {
        return ju.apply(this, arguments)
    }

    function ju() {
        return (ju = i(regeneratorRuntime.mark((function e(t) {
            var n, r, i;
            return regeneratorRuntime.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                case 0:
                    return e.prev = 0, n = {
                        userId: String(t.userId),
                        sdkAppId: String(t.sdkAppId),
                        isStrGroupId: t.useStringRoomId,
                        groupId: String(t.roomId),
                        sdkVersion: "4.11.8",
                        userSig: String(t.userSig)
                    }, r = Vu(), e.next = 5, pu.post(Xs, n, {
                        timeout: 1500
                    });
                case 5:
                    if (i = e.sent, Su("stat-schedule-delta:".concat(Vu() - r)), 0 !== i.data.code) {
                        e.next = 9;
                        break
                    }
                    return e.abrupt("return", i.data.data);
                case 9:
                    Kd.debug("schedule failed: " + i.data.msg), e.next = 15;
                    break;
                case 12:
                    e.prev = 12, e.t0 = e.catch(0), Kd.debug("schedule failed: " + e.t0);
                case 15:
                case "end":
                    return e.stop()
                }
            }), e, null, [
                [0, 12]
            ])
        })))).apply(this, arguments)
    }
    var Bu, Hu = window.navigator && window.navigator.userAgent || "",
        Gu = /AppleWebKit\/([\d.]+)/i.exec(Hu),
        Ju = (Gu && parseFloat(Gu.pop()), /iPad/i.test(Hu)),
        zu = /iPhone/i.test(Hu) && !Ju,
        Wu = /iPod/i.test(Hu),
        qu = zu || Ju || Wu,
        Ku = "15.1" === (qu && function () {
            var e = Hu.match(/OS (\d+)_(\d+)/i);
            if (e && e[1]) {
                var t = e[1];
                return e[2] && (t += ".".concat(e[2])), t
            }
            return null
        }()),
        Qu = /Android/i.test(Hu),
        Xu = Qu && function () {
            var e = Hu.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
            if (!e) return null;
            var t = e[1] && parseFloat(e[1]),
                n = e[2] && parseFloat(e[2]);
            return t && n ? parseFloat(e[1] + "." + e[2]) : t || null
        }(),
        Yu = (Qu && /webkit/i.test(Hu), /Firefox/i.test(Hu)),
        $u = Yu && function () {
            var e = Hu.match(/Firefox\/(\d+)/);
            return e && e[1] ? parseFloat(e[1]) : null
        }(),
        Zu = /Edge\//i.test(Hu),
        ed = Zu && function () {
            var e = Hu.match(/Edge\/(\d+)/i);
            if (e && e[1]) return e[1]
        }(),
        td = /Edg\//i.test(Hu),
        nd = td && function () {
            var e = Hu.match(/Edg\/(\d+)/);
            return e && e[1] ? parseFloat(e[1]) : null
        }(),
        rd = /SogouMobileBrowser\//i.test(Hu),
        id = rd && function () {
            var e = Hu.match(/SogouMobileBrowser\/(\d+)/);
            return e && e[1] ? parseFloat(e[1]) : null
        }(),
        ad = /MetaSr\s/i.test(Hu),
        od = ad && function () {
            var e = Hu.match(/MetaSr(\s\d+(\.\d+)+)/);
            return e && e[1] ? parseFloat(e[1]) : null
        }(),
        sd = /TBS\/\d+/i.test(Hu),
        cd = sd && function () {
            var e = Hu.match(/TBS\/(\d+)/i);
            if (e && e[1]) return e[1]
        }(),
        ud = /XWEB\/\d+/i.test(Hu),
        dd = ud && function () {
            var e = Hu.match(/XWEB\/(\d+)/i);
            if (e && e[1]) return e[1]
        }(),
        ld = (/MSIE\s8\.0/.test(Hu), /MSIE\/\d+/i.test(Hu) && function () {
            var e = /MSIE\s(\d+)\.\d/.exec(Hu),
                t = e && parseFloat(e[1]);
            !t && /Trident\/7.0/i.test(Hu) && /rv:11.0/.test(Hu) && (t = 11)
        }(), /(micromessenger|webbrowser)/i.test(Hu)),
        hd = ld && function () {
            var e = Hu.match(/MicroMessenger\/(\d+)/i);
            if (e && e[1]) return e[1]
        }(),
        pd = !sd && /MQQBrowser\/\d+/i.test(Hu) && /COVC\/\d+/i.test(Hu),
        fd = !sd && /MQQBrowser\/\d+/i.test(Hu) && !/COVC\/\d+/i.test(Hu),
        md = (fd || pd) && function () {
            var e = Hu.match(/ MQQBrowser\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        _d = !sd && / QQBrowser\/\d+/i.test(Hu),
        vd = _d && function () {
            var e = Hu.match(/ QQBrowser\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        gd = !sd && /QQBrowserLite\/\d+/i.test(Hu),
        Sd = gd && function () {
            var e = Hu.match(/QQBrowserLite\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        yd = !sd && /MQBHD\/\d+/i.test(Hu),
        Td = yd && function () {
            var e = Hu.match(/MQBHD\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        kd = /Windows/i.test(Hu),
        bd = !qu && /MAC OS X/i.test(Hu),
        Rd = !Qu && /Linux/i.test(Hu),
        Ed = (/MicroMessenger/i.test(Hu), /UCBrowser/i.test(Hu)),
        Id = (/Electron/i.test(Hu), /MiuiBrowser/i.test(Hu)),
        Cd = Id && function () {
            var e = Hu.match(/MiuiBrowser\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        wd = /HuaweiBrowser/i.test(Hu),
        Ad = /Huawei/i.test(Hu),
        Pd = wd && function () {
            var e = Hu.match(/HuaweiBrowser\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        Dd = /SamsungBrowser/i.test(Hu),
        xd = Dd && function () {
            var e = Hu.match(/SamsungBrowser\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        Od = /HeyTapBrowser/i.test(Hu),
        Nd = Od && function () {
            var e = Hu.match(/HeyTapBrowser\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        Md = /VivoBrowser/i.test(Hu),
        Ld = Md && function () {
            var e = Hu.match(/VivoBrowser\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        Vd = /Chrome/i.test(Hu),
        Ud = !Zu && !ad && !rd && !sd && !ud && !td && !_d && !Id && !wd && !Dd && !Od && !Md && /Chrome/i.test(Hu),
        Fd = Ud && function () {
            var e = Hu.match(/Chrome\/(\d+)/);
            return e && e[1] ? parseFloat(e[1]) : null
        }(),
        jd = Ud && function () {
            var e = Hu.match(/Chrome\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        Bd = !Vd && !fd && !pd && !gd && !yd && /Safari/i.test(Hu),
        Hd = Bd && function () {
            var e = Hu.match(/Version\/([\d.]+)/);
            return e && e[1] ? e[1] : null
        }(),
        Gd = Ud ? "Chrome/" + jd : Bd ? "Safari/" + Hd : "NotSupportedBrowser",
        Jd = "file:" === location.protocol || "localhost" === location.hostname || /^\d+\.\d+\.\d+\.\d+$/.test(location.hostname),
        zd = function () {
            if (Du(Bu)) try {
                Bu = window.localStorage
            } catch (GS) {
                Kd.warn(GS), Bu = !1
            }
            return Bu
        },
        Wd = new Map([
            [Yu, ["Firefox", $u]],
            [td, ["Edg", nd]],
            [Ud, ["Chrome", jd]],
            [Bd, ["Safari", Hd]],
            [sd, ["TBS", cd]],
            [ud, ["XWEB", dd]],
            [ld && zu, ["WeChat", hd]],
            [_d, ["QQ(Win)", vd]],
            [fd, ["QQ(Mobile)", md]],
            [pd, ["QQ(Mobile X5)", md]],
            [gd, ["QQ(Mac)", Sd]],
            [yd, ["QQ(iPad)", Td]],
            [Id, ["MI", Cd]],
            [wd, ["HW", Pd]],
            [Dd, ["Samsung", xd]],
            [Od, ["OPPO", Nd]],
            [Md, ["VIVO", Ld]],
            [Zu, ["EDGE", ed]],
            [rd, ["SogouMobile", id]],
            [ad, ["Sogou", od]]
        ]);

    function qd() {
        var e = "unknown",
            t = "unknown";
        return Wd.get(!0) && (e = Wd.get(!0)[0], t = Wd.get(!0)[1]), {
            name: e,
            version: t
        }
    }
    var Kd = function () {
            var e = function () {},
                t = ["trace", "debug", "info", "warn", "error"];

            function r(e, t) {
                var n = e[t];
                if (Pu(n.bind)) return n.bind(e);
                try {
                    return Function.prototype.bind.call(n, e)
                } catch (GS) {
                    return function () {
                        return Function.prototype.apply.apply(n, [e, arguments])
                    }
                }
            }

            function i(t) {
                return "debug" === t && (t = "log"), "undefined" !== ("undefined" == typeof console ? "undefined" : n(console)) && (void 0 !== console[t] ? r(console, t) : void 0 !== console.log ? r(console, "log") : e)
            }

            function a(e, n) {
                for (var r = 0; r < t.length; r++) {
                    var i = t[r];
                    this[i] = this.methodFactory(i, e, n)
                }
                this.log = this.debug
            }

            function o(e, t, r) {
                return function () {
                    "undefined" !== ("undefined" == typeof console ? "undefined" : n(console)) && (a.call(this, t, r), this[e].apply(this, arguments))
                }
            }

            function s(e, t, n) {
                return i(e) || o.apply(this, arguments)
            }

            function c(e, r, i) {
                var o, c = this,
                    u = "loglevel";

                function d() {
                    var e;
                    if ("undefined" !== ("undefined" == typeof window ? "undefined" : n(window))) {
                        try {
                            zd() && (e = window.localStorage[u])
                        } catch (t) {}
                        return void 0 === c.levels[e] && (e = void 0), e
                    }
                }
                e && (u += ":" + e), c.name = e, c.levels = {
                    TRACE: 0,
                    DEBUG: 1,
                    INFO: 2,
                    WARN: 3,
                    ERROR: 4,
                    SILENT: 5
                }, c.methodFactory = i || s, c.getLevel = function () {
                    return o
                }, c.setLevel = function (r, i) {
                    if (xu(r) && void 0 !== c.levels[r.toUpperCase()] && (r = c.levels[r.toUpperCase()]), !(Ou(r) && r >= 0 && r <= c.levels.SILENT)) throw "log.setLevel() called with invalid level: " + r;
                    if (o = r, !1 !== i && function (e) {
                        var r = (t[e] || "silent").toUpperCase();
                        if ("undefined" !== ("undefined" == typeof window ? "undefined" : n(window))) try {
                            zd() && (window.localStorage[u] = r)
                        } catch (i) {}
                    }(r), a.call(c, r, e), "undefined" === ("undefined" == typeof console ? "undefined" : n(console)) && r < c.levels.SILENT) return "No console available for logging"
                }, c.setDefaultLevel = function (e) {
                    d() || c.setLevel(e, !1)
                }, c.enableAll = function (e) {
                    c.setLevel(c.levels.TRACE, e)
                }, c.disableAll = function (e) {
                    c.setLevel(c.levels.SILENT, e)
                };
                var l = d();
                null == l && (l = null == r ? "WARN" : r), c.setLevel(l, !1)
            }
            var u = new c,
                d = {};
            u.getLogger = function (e) {
                if (!xu(e) || "" === e) throw new TypeError("You must supply a name when creating a logger.");
                var t = d[e];
                return t || (t = d[e] = new c(e, u.getLevel(), u.methodFactory)), t
            };
            var l = "undefined" !== ("undefined" == typeof window ? "undefined" : n(window)) ? window.log : void 0;
            return u.noConflict = function () {
                return "undefined" !== ("undefined" == typeof window ? "undefined" : n(window)) && window.log === u && (window.log = l), u
            }, u.getLoggers = function () {
                return d
            }, u
        }(),
        Qd = Wt("slice"),
        Xd = _e("species"),
        Yd = [].slice,
        $d = Math.max;
    Et({
        target: "Array",
        proto: !0,
        forced: !Qd
    }, {
        slice: function (e, t) {
            var n, r, i, a = B(this),
                o = ot(a),
                s = rt(e, o),
                c = rt(void 0 === t ? o : t, o);
            if (Ct(a) && (n = a.constructor, (Ft(n) && (n === Array || Ct(n.prototype)) || G(n) && null === (n = n[Xd])) && (n = void 0), n === Array || void 0 === n)) return Yd.call(a, s, c);
            for (r = new(void 0 === n ? Array : n)($d(c - s, 0)), i = 0; s < c; s++, i++) s in a && fo(r, i, a[s]);
            return r.length = i, r
        }
    });
    var Zd = [].join,
        el = F != Object,
        tl = Ka("join", ",");
    Et({
        target: "Array",
        proto: !0,
        forced: el || !tl
    }, {
        join: function (e) {
            return Zd.call(B(this), void 0 === e ? "," : e)
        }
    }), Et({
        target: "Array",
        stat: !0
    }, {
        isArray: Ct
    });
    var nl = Wt("splice"),
        rl = Math.max,
        il = Math.min;
    Et({
        target: "Array",
        proto: !0,
        forced: !nl
    }, {
        splice: function (e, t) {
            var n, r, i, a, o, s, c = se(this),
                u = ot(c),
                d = rt(e, u),
                l = arguments.length;
            if (0 === l ? n = r = 0 : 1 === l ? (n = 0, r = u - d) : (n = l - 2, r = il(rl(et(t), 0), u - d)), u + n - r > 9007199254740991) throw TypeError("Maximum allowed length exceeded");
            for (i = Bt(c, r), a = 0; a < r; a++)(o = d + a) in c && fo(i, a, c[o]);
            if (i.length = r, n < r) {
                for (a = d; a < u - r; a++) s = a + n, (o = a + r) in c ? c[s] = c[o] : delete c[s];
                for (a = u; a > u - r + n; a--) delete c[a - 1]
            } else if (n > r)
                for (a = u - r; a > d; a--) s = a + n - 1, (o = a + r - 1) in c ? c[s] = c[o] : delete c[s];
            for (a = 0; a < n; a++) c[a + d] = arguments[a + 2];
            return c.length = u - r + n, i
        }
    });
    var al = function (e) {
            var t = gr(j(this)),
                n = "",
                r = et(e);
            if (r < 0 || Infinity == r) throw RangeError("Wrong number of repetitions");
            for (; r > 0;
                (r >>>= 1) && (t += t)) 1 & r && (n += t);
            return n
        },
        ol = Math.ceil,
        sl = function (e) {
            return function (t, n, r) {
                var i, a, o = gr(j(t)),
                    s = at(n),
                    c = o.length,
                    u = void 0 === r ? " " : gr(r);
                return s <= c || "" == u ? o : ((a = al.call(u, ol((i = s - c) / u.length))).length > i && (a = a.slice(0, i)), e ? o + a : a + o)
            }
        },
        cl = {
            start: sl(!1),
            end: sl(!0)
        }.start,
        ul = Math.abs,
        dl = Date.prototype,
        ll = dl.getTime,
        hl = dl.toISOString,
        pl = P((function () {
            return "0385-07-25T07:06:39.999Z" != hl.call(new Date(-50000000000001))
        })) || !P((function () {
            hl.call(new Date(NaN))
        })) ? function () {
            if (!isFinite(ll.call(this))) throw RangeError("Invalid time value");
            var e = this.getUTCFullYear(),
                t = this.getUTCMilliseconds(),
                n = e < 0 ? "-" : e > 9999 ? "+" : "";
            return n + cl(ul(e), n ? 6 : 4, 0) + "-" + cl(this.getUTCMonth() + 1, 2, 0) + "-" + cl(this.getUTCDate(), 2, 0) + "T" + cl(this.getUTCHours(), 2, 0) + ":" + cl(this.getUTCMinutes(), 2, 0) + ":" + cl(this.getUTCSeconds(), 2, 0) + "." + cl(t, 3, 0) + "Z"
        } : hl;
    Et({
        target: "Date",
        proto: !0,
        forced: Date.prototype.toISOString !== pl
    }, {
        toISOString: pl
    });
    var fl = Jt.some,
        ml = Ka("some");
    Et({
        target: "Array",
        proto: !0,
        forced: !ml
    }, {
        some: function (e) {
            return fl(this, e, arguments.length > 1 ? arguments[1] : void 0)
        }
    });
    var _l = [].slice,
        vl = /MSIE .\./.test(W),
        gl = function (e) {
            return function (t, n) {
                var r = arguments.length > 2,
                    i = r ? _l.call(arguments, 2) : void 0;
                return e(r ? function () {
                    (H(t) ? t : Function(t)).apply(this, i)
                } : t, n)
            }
        };
    Et({
        global: !0,
        bind: !0,
        forced: vl
    }, {
        setTimeout: gl(A.setTimeout),
        setInterval: gl(A.setInterval)
    });
    var Sl, yl = function () {
            return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function (e) {
                var t = 16 * Math.random() | 0;
                return ("x" == e ? t : 3 & t | 8).toString(16)
            }))
        },
        Tl = new(function () {
            function e() {
                a(this, e), this.intervalMap_ = new Map
            }
            return s(e, [{
                key: "setInterval",
                value: function (e) {
                    function t(t, n) {
                        return e.apply(this, arguments)
                    }
                    return t.toString = function () {
                        return e.toString()
                    }, t
                }((function (e, t) {
                    var n = this,
                        r = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2];
                    if (!window || !window.requestAnimationFrame) return setInterval(e, t);
                    var i = yl(),
                        a = Vu(),
                        o = a;
                    this.intervalMap_.set(i, {
                        rafId: null,
                        timeoutId: null,
                        onVisibilityChange: null
                    });
                    var s = function s() {
                            if (r && document.hidden) {
                                e();
                                var c = setTimeout(s, t);
                                n.setTimeoutId(i, c), a = Vu(), o = a
                            } else {
                                (o = Vu()) - a >= t && (a = o, e());
                                var u = requestAnimationFrame(s);
                                n.setRafId(i, u)
                            }
                        },
                        c = requestAnimationFrame(s);
                    if (this.setRafId(i, c), r) {
                        var u = function () {
                            if (document.hidden) {
                                var e = Vu() - a;
                                if (e >= t) s();
                                else {
                                    var r = setTimeout(s, t - e);
                                    n.setTimeoutId(i, r)
                                }
                            }
                        };
                        document.addEventListener("visibilitychange", u), this.setOnVisibilityChange(i, u)
                    }
                    return i
                }))
            }, {
                key: "clearInterval",
                value: function (e) {
                    if (this.intervalMap_.has(e)) {
                        var t = this.intervalMap_.get(e),
                            n = t.rafId,
                            r = t.timeoutId,
                            i = t.onVisibilityChange;
                        cancelAnimationFrame(n), clearTimeout(r), document.removeEventListener("visibilitychange", i), this.intervalMap_.delete(e)
                    }
                }
            }, {
                key: "setTimeoutId",
                value: function (e, t) {
                    if (this.intervalMap_.has(e)) {
                        var n = this.intervalMap_.get(e);
                        n.timeoutId && clearTimeout(n.timeoutId), n.timeoutId = t
                    }
                }
            }, {
                key: "setRafId",
                value: function (e, t) {
                    if (this.intervalMap_.has(e)) {
                        var n = this.intervalMap_.get(e);
                        n.rafId && cancelAnimationFrame(n.rafId), n.rafId = t
                    }
                }
            }, {
                key: "setOnVisibilityChange",
                value: function (e, t) {
                    this.intervalMap_.has(e) && (this.intervalMap_.get(e).onVisibilityChange = t)
                }
            }]), e
        }());

    function kl(e) {
        try {
            return JSON.stringify(e)
        } catch (GS) {
            if (!Sl) try {
                var t = {};
                t.a = t, JSON.stringify(t)
            } catch (n) {
                Sl = n.message
            }
            if (GS.message === Sl) return "[Circular]";
            throw GS
        }
    }

    function bl(e) {
        var t = "",
            n = 0;
        return e.length > 1 && xu(e[0]) && (t = (t = e[0].replace(/(%?)(%([sdjo]))/g, (function (t, r, i, a) {
            if (!r) {
                var o = e[n += 1],
                    s = "";
                switch (a) {
                case "s":
                    s += o;
                    break;
                case "d":
                    s += +o;
                    break;
                case "j":
                    s = kl(o);
                    break;
                case "o":
                    var c = kl(o);
                    "{" !== c[0] && "[" !== c[0] && (c = "<".concat(c, ">")), s = function (e) {
                        if (!Object.getOwnPropertyDescriptor || !Object.getPrototypeOf) return Object.prototype.toString.call(e).slice(8, -1);
                        for (; e;) {
                            var t = Object.getOwnPropertyDescriptor(e, "constructor");
                            if (void 0 !== t && Pu(t.value) && "" !== t.value.name) return t.value.name;
                            e = Object.getPrototypeOf(e)
                        }
                        return ""
                    }(o) + c
                }
                return s
            }
            return t
        }))).replace(/%{2,2}/g, "%"), n += 1), e.length > n && (t && (t += " "), t += e.slice(n).join(" ")), t
    }
    var Rl = Object.prototype.hasOwnProperty;

    function El() {
        try {
            throw new Error
        } catch (e) {
            return e.stack
        }
    }

    function Il(e) {
        var t = this,
            n = [],
            r = [];
        this.length = function () {
            return n.length
        }, this.sent = function () {
            return r.length
        }, this.push = function (t) {
            n.push(t), n.length > e && n.shift()
        }, this.send = function () {
            return r.length || (r = n, n = []), r
        }, this.confirm = function () {
            r = [], t.content = ""
        }, this.fail = function () {
            n = r.concat(n), t.confirm();
            var i = 1 + n.length + r.length - e;
            i > 0 && (r.splice(0, i), n = r.concat(n), t.confirm())
        }
    }
    var Cl, wl, Al, Pl = !!El();

    function Dl(e) {
        return "[".concat(e.timestamp, "] <").concat(e.level.label.toUpperCase(), ">").concat(e.logger ? " (".concat(e.logger, ")") : "", ": ").concat(e.message).concat(e.stacktrace ? "\n".concat(e.stacktrace) : "")
    }
    var xl = {
            interval: 1e3,
            level: "trace",
            capacity: 0,
            stacktrace: {
                levels: ["trace", "warn", "error"],
                depth: 3,
                excess: 0
            },
            timestamp: function () {
                return (new Date).toISOString()
            }, format: Dl
        },
        Ol = -1,
        Nl = !1,
        Ml = "",
        Ll = "",
        Vl = "",
        Ul = function (e) {
            Nl || (Ml = "".concat(e.sdkAppId), Ll = "".concat(e.userId), Vl = "".concat(e.version), Nl = !0)
        },
        Fl = function (e, t) {
            if (!e || !e.getLogger) throw new TypeError("Argument is not a root loglevel object");
            if (Cl) throw new Error("You can assign a plugin only one time");
            Cl = e;
            var r = function e() {
                for (var t = {}, r = 0; r < arguments.length; r += 1) {
                    var i = Object(arguments[r]);
                    for (var a in i) Rl.call(i, a) && (t[a] = "object" !== n(i[a]) || Array.isArray(i[a]) ? i[a] : e(t[a], i[a]))
                }
                return t
            }(xl, t);
            r.capacity = r.capacity || 500;
            var i, a = r.interval;
            Ol = Tl.setInterval((function () {
                if (!Nl) return;
                if (!o.sent()) {
                    if (!o.length()) return;
                    var e = o.send();
                    o.content = i ? '{"logs":['.concat(e.join(","), "]}") : e.join("\n"),
                        function (e) {
                            if (!Nl) return;
                            var t = JSON.stringify({
                                timestamp: _u(),
                                sdkAppId: Ml,
                                userId: Ll,
                                version: Vl,
                                log: e
                            });
                            pu.post(Eu(), t).then((function () {
                                o.confirm()
                            })).catch((function () {
                                o.fail()
                            }))
                        }(o.content)
                }
            }), a);
            var o = new Il(r.capacity);
            return wl = e.methodFactory, Al = function (e, t, n) {
                var a = wl(e, t, n),
                    s = Pl && r.stacktrace.levels.some((function (t) {
                        return t === e
                    })),
                    c = Cl.levels[e.toUpperCase()];
                return function () {
                    for (var u = arguments.length, d = new Array(u), l = 0; l < u; l++) d[l] = arguments[l];
                    var h = bl(d),
                        p = c >= t;
                    if (p) {
                        var f = new Date;
                        f.setTime(mu());
                        var m = f.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1") + ":".concat(f.getMilliseconds()),
                            _ = "[" + m + "] <" + e.toUpperCase() + "> " + h;
                        a.apply(void 0, [_])
                    }
                    var v = _u(),
                        g = s ? El() : "";
                    if (g) {
                        var S = g.split("\n");
                        S.splice(0, r.stacktrace.excess + 3);
                        var y = r.stacktrace.depth;
                        if (y && S.length !== y + 1) {
                            var T = S.splice(0, y);
                            g = T.join("\n"), S.length && (g += "\n    and ".concat(S.length, " more"))
                        } else g = S.join("\n")
                    }
                    var k = r.format({
                        message: h,
                        level: {
                            label: e,
                            value: c
                        },
                        logger: n || "",
                        timestamp: v,
                        stacktrace: g
                    });
                    void 0 === i && (i = !xu(k));
                    var b = "";
                    if (i) try {
                        b += JSON.stringify(k)
                    } catch (GS) {
                        return a.apply(void 0, d), void Cl.getLogger("logger").error(GS)
                    } else b += k;
                    o.push(b)
                }
            }, e.methodFactory = Al, e.setLevel(e.getLevel()), e
        },
        jl = function () {
            if (!Cl) throw new Error("You can't disable a not appled plugin");
            if (Al !== Cl.methodFactory) throw new Error("You can't disable a plugin after appling another plugin");
            Cl.methodFactory = wl, Cl.setLevel(Cl.getLevel()), Cl = void 0, Tl.clearInterval(Ol)
        },
        Bl = !1;
    Kd.setConfig = function (e) {
        Ul(e)
    }, Kd.setLogLevel = function (e) {
        Kd.setLevel(e)
    }, Kd.getLogLevel = function (e) {
        return Kd.getLevel(e)
    }, Kd.enableUploadLog = function () {
        Bl || (Fl(Kd), Bl = !0)
    }, Kd.disableUploadLog = function () {
        Bl && (Kd.warn("disable upload log! Without log we are difficult to help you triage the issue you might run into!"), jl(), Bl = !1)
    }, Kd.enableUploadLog(), Kd.setLevel("INFO");
    var Hl = !0,
        Gl = Math.floor,
        Jl = Number.isInteger || function (e) {
            return !G(e) && isFinite(e) && Gl(e) === e
        };
    Et({
        target: "Number",
        stat: !0
    }, {
        isInteger: Jl
    });
    var zl, Wl = function (e) {
            if (Ia(e)) throw TypeError("The method doesn't accept regular expressions");
            return e
        },
        ql = _e("match"),
        Kl = function (e) {
            var t = /./;
            try {
                "/./" [e](t)
            } catch (n) {
                try {
                    return t[ql] = !1, "/./" [e](t)
                } catch (r) {}
            }
            return !1
        },
        Ql = Ee.f,
        Xl = "".startsWith,
        Yl = Math.min,
        $l = Kl("startsWith"),
        Zl = !($l || (zl = Ql(String.prototype, "startsWith"), !zl || zl.writable));
    Et({
        target: "String",
        proto: !0,
        forced: !Zl && !$l
    }, {
        startsWith: function (e) {
            var t = gr(j(this));
            Wl(e);
            var n = at(Yl(arguments.length > 1 ? arguments[1] : void 0, t.length)),
                r = gr(e);
            return Xl ? Xl.call(t, r, n) : t.slice(n, n + r.length) === r
        }
    });
    var eh = Jt.forEach,
        th = Ka("forEach") ? [].forEach : function (e) {
            return eh(this, e, arguments.length > 1 ? arguments[1] : void 0)
        };
    Et({
        target: "Array",
        proto: !0,
        forced: [].forEach != th
    }, {
        forEach: th
    });
    var nh = function (e) {
        if (e && e.forEach !== th) try {
            Ae(e, "forEach", th)
        } catch (GS) {
            e.forEach = th
        }
    };
    for (var rh in ma) ma[rh] && nh(A[rh] && A[rh].prototype);
    nh(ga);
    var ih, ah, oh, sh, ch = A.Promise,
        uh = /(?:ipad|iphone|ipod).*applewebkit/i.test(W),
        dh = "process" == V(A.process),
        lh = A.setImmediate,
        hh = A.clearImmediate,
        ph = A.process,
        fh = A.MessageChannel,
        mh = A.Dispatch,
        _h = 0,
        vh = {};
    try {
        ih = A.location
    } catch (GS) {}
    var gh = function (e) {
            if (vh.hasOwnProperty(e)) {
                var t = vh[e];
                delete vh[e], t()
            }
        },
        Sh = function (e) {
            return function () {
                gh(e)
            }
        },
        yh = function (e) {
            gh(e.data)
        },
        Th = function (e) {
            A.postMessage(String(e), ih.protocol + "//" + ih.host)
        };
    lh && hh || (lh = function (e) {
        for (var t = [], n = arguments.length, r = 1; n > r;) t.push(arguments[r++]);
        return vh[++_h] = function () {
            (H(e) ? e : Function(e)).apply(void 0, t)
        }, ah(_h), _h
    }, hh = function (e) {
        delete vh[e]
    }, dh ? ah = function (e) {
        ph.nextTick(Sh(e))
    } : mh && mh.now ? ah = function (e) {
        mh.now(Sh(e))
    } : fh && !uh ? (sh = (oh = new fh).port2, oh.port1.onmessage = yh, ah = It(sh.postMessage, sh, 1)) : A.addEventListener && H(A.postMessage) && !A.importScripts && ih && "file:" !== ih.protocol && !P(Th) ? (ah = Th, A.addEventListener("message", yh, !1)) : ah = "onreadystatechange" in ke("script") ? function (e) {
        Rr.appendChild(ke("script")).onreadystatechange = function () {
            Rr.removeChild(this), gh(e)
        }
    } : function (e) {
        setTimeout(Sh(e), 0)
    });
    var kh, bh, Rh, Eh, Ih, Ch, wh, Ah, Ph = {
            set: lh,
            clear: hh
        },
        Dh = /ipad|iphone|ipod/i.test(W) && void 0 !== A.Pebble,
        xh = /web0s(?!.*chrome)/i.test(W),
        Oh = Ee.f,
        Nh = Ph.set,
        Mh = A.MutationObserver || A.WebKitMutationObserver,
        Lh = A.document,
        Vh = A.process,
        Uh = A.Promise,
        Fh = Oh(A, "queueMicrotask"),
        jh = Fh && Fh.value;
    jh || (kh = function () {
        var e, t;
        for (dh && (e = Vh.domain) && e.exit(); bh;) {
            t = bh.fn, bh = bh.next;
            try {
                t()
            } catch (GS) {
                throw bh ? Eh() : Rh = void 0, GS
            }
        }
        Rh = void 0, e && e.enter()
    }, uh || dh || xh || !Mh || !Lh ? !Dh && Uh && Uh.resolve ? ((wh = Uh.resolve(void 0)).constructor = Uh, Ah = wh.then, Eh = function () {
        Ah.call(wh, kh)
    }) : Eh = dh ? function () {
        Vh.nextTick(kh)
    } : function () {
        Nh.call(A, kh)
    } : (Ih = !0, Ch = Lh.createTextNode(""), new Mh(kh).observe(Ch, {
        characterData: !0
    }), Eh = function () {
        Ch.data = Ih = !Ih
    }));
    var Bh, Hh, Gh, Jh, zh = jh || function (e) {
            var t = {
                fn: e,
                next: void 0
            };
            Rh && (Rh.next = t), bh || (bh = t, Eh()), Rh = t
        },
        Wh = function (e) {
            var t, n;
            this.promise = new e((function (e, r) {
                if (void 0 !== t || void 0 !== n) throw TypeError("Bad Promise constructor");
                t = e, n = r
            })), this.resolve = ne(t), this.reject = ne(n)
        },
        qh = {
            f: function (e) {
                return new Wh(e)
            }
        },
        Kh = function (e) {
            try {
                return {
                    error: !1,
                    value: e()
                }
            } catch (GS) {
                return {
                    error: !0,
                    value: GS
                }
            }
        },
        Qh = "object" == typeof window,
        Xh = Ph.set,
        Yh = _e("species"),
        $h = "Promise",
        Zh = We.get,
        ep = We.set,
        tp = We.getterFor($h),
        np = ch && ch.prototype,
        rp = ch,
        ip = np,
        ap = A.TypeError,
        op = A.document,
        sp = A.process,
        cp = qh.f,
        up = cp,
        dp = !!(op && op.createEvent && A.dispatchEvent),
        lp = H(A.PromiseRejectionEvent),
        hp = !1,
        pp = bt($h, (function () {
            var e = Ne(rp),
                t = e !== String(rp);
            if (!t && 66 === Y) return !0;
            if (Y >= 51 && /native code/.test(e)) return !1;
            var n = new rp((function (e) {
                    e(1)
                })),
                r = function (e) {
                    e((function () {}), (function () {}))
                };
            return (n.constructor = {})[Yh] = r, !(hp = n.then((function () {})) instanceof r) || !t && Qh && !lp
        })),
        fp = pp || !na((function (e) {
            rp.all(e).catch((function () {}))
        })),
        mp = function (e) {
            var t;
            return !(!G(e) || !H(t = e.then)) && t
        },
        _p = function (e, t) {
            if (!e.notified) {
                e.notified = !0;
                var n = e.reactions;
                zh((function () {
                    for (var r = e.value, i = 1 == e.state, a = 0; n.length > a;) {
                        var o, s, c, u = n[a++],
                            d = i ? u.ok : u.fail,
                            l = u.resolve,
                            h = u.reject,
                            p = u.domain;
                        try {
                            d ? (i || (2 === e.rejection && yp(e), e.rejection = 1), !0 === d ? o = r : (p && p.enter(), o = d(r), p && (p.exit(), c = !0)), o === u.promise ? h(ap("Promise-chain cycle")) : (s = mp(o)) ? s.call(o, l, h) : l(o)) : h(r)
                        } catch (GS) {
                            p && !c && p.exit(), h(GS)
                        }
                    }
                    e.reactions = [], e.notified = !1, t && !e.rejection && gp(e)
                }))
            }
        },
        vp = function (e, t, n) {
            var r, i;
            dp ? ((r = op.createEvent("Event")).promise = t, r.reason = n, r.initEvent(e, !1, !0), A.dispatchEvent(r)) : r = {
                promise: t,
                reason: n
            }, !lp && (i = A["on" + e]) ? i(r) : "unhandledrejection" === e && function (e, t) {
                var n = A.console;
                n && n.error && (1 === arguments.length ? n.error(e) : n.error(e, t))
            }("Unhandled promise rejection", n)
        },
        gp = function (e) {
            Xh.call(A, (function () {
                var t, n = e.facade,
                    r = e.value;
                if (Sp(e) && (t = Kh((function () {
                    dh ? sp.emit("unhandledRejection", r, n) : vp("unhandledrejection", n, r)
                })), e.rejection = dh || Sp(e) ? 2 : 1, t.error)) throw t.value
            }))
        },
        Sp = function (e) {
            return 1 !== e.rejection && !e.parent
        },
        yp = function (e) {
            Xh.call(A, (function () {
                var t = e.facade;
                dh ? sp.emit("rejectionHandled", t) : vp("rejectionhandled", t, e.value)
            }))
        },
        Tp = function (e, t, n) {
            return function (r) {
                e(t, r, n)
            }
        },
        kp = function (e, t, n) {
            e.done || (e.done = !0, n && (e = n), e.value = t, e.state = 2, _p(e, !0))
        },
        bp = function (e, t, n) {
            if (!e.done) {
                e.done = !0, n && (e = n);
                try {
                    if (e.facade === t) throw ap("Promise can't be resolved itself");
                    var r = mp(t);
                    r ? zh((function () {
                        var n = {
                            done: !1
                        };
                        try {
                            r.call(t, Tp(bp, n, e), Tp(kp, n, e))
                        } catch (GS) {
                            kp(n, GS, e)
                        }
                    })) : (e.value = t, e.state = 1, _p(e, !1))
                } catch (GS) {
                    kp({
                        done: !1
                    }, GS, e)
                }
            }
        };
    if (pp && (ip = (rp = function (e) {
        Yi(this, rp, $h), ne(e), Bh.call(this);
        var t = Zh(this);
        try {
            e(Tp(bp, t), Tp(kp, t))
        } catch (GS) {
            kp(t, GS)
        }
    }).prototype, (Bh = function (e) {
        ep(this, {
            type: $h,
            done: !1,
            notified: !1,
            parent: !1,
            reactions: [],
            rejection: !1,
            state: 0,
            value: void 0
        })
    }).prototype = ia(ip, {
        then: function (e, t) {
                var n = tp(this),
                    r = cp(bo(this, rp));
                return r.ok = !H(e) || e, r.fail = H(t) && t, r.domain = dh ? sp.domain : void 0, n.parent = !0, n.reactions.push(r), 0 != n.state && _p(n, !1), r.promise
            },
            catch: function (e) {
                return this.then(void 0, e)
            }
    }), Hh = function () {
        var e = new Bh,
            t = Zh(e);
        this.promise = e, this.resolve = Tp(bp, t), this.reject = Tp(kp, t)
    }, qh.f = cp = function (e) {
        return e === rp || e === Gh ? new Hh(e) : up(e)
    }, H(ch) && np !== Object.prototype)) {
        Jh = np.then, hp || (Ye(np, "then", (function (e, t) {
            var n = this;
            return new rp((function (e, t) {
                Jh.call(n, e, t)
            })).then(e, t)
        }), {
            unsafe: !0
        }), Ye(np, "catch", ip.catch, {
            unsafe: !0
        }));
        try {
            delete np.constructor
        } catch (GS) {}
        Ci && Ci(np, ip)
    }
    Et({
        global: !0,
        wrap: !0,
        forced: pp
    }, {
        Promise: rp
    }), Ri(rp, $h, !1), oa($h), Gh = z($h), Et({
        target: $h,
        stat: !0,
        forced: pp
    }, {
        reject: function (e) {
            var t = cp(this);
            return t.reject.call(void 0, e), t.promise
        }
    }), Et({
        target: $h,
        stat: !0,
        forced: pp
    }, {
        resolve: function (e) {
            return function (e, t) {
                if (Ie(e), G(t) && t.constructor === e) return t;
                var n = qh.f(e);
                return (0, n.resolve)(t), n.promise
            }(this, e)
        }
    }), Et({
        target: $h,
        stat: !0,
        forced: fp
    }, {
        all: function (e) {
            var t = this,
                n = cp(t),
                r = n.resolve,
                i = n.reject,
                a = Kh((function () {
                    var n = ne(t.resolve),
                        a = [],
                        o = 0,
                        s = 1;
                    Xi(e, (function (e) {
                        var c = o++,
                            u = !1;
                        a.push(void 0), s++, n.call(t, e).then((function (e) {
                            u || (u = !0, a[c] = e, --s || r(a))
                        }), i)
                    })), --s || r(a)
                }));
            return a.error && i(a.value), n.promise
        }, race: function (e) {
            var t = this,
                n = cp(t),
                r = n.reject,
                i = Kh((function () {
                    var i = ne(t.resolve);
                    Xi(e, (function (e) {
                        i.call(t, e).then(n.resolve, r)
                    }))
                }));
            return i.error && r(i.value), n.promise
        }
    });
    var Rp = Kr.trim,
        Ep = A.parseInt,
        Ip = A.Symbol,
        Cp = Ip && Ip.iterator,
        wp = /^[+-]?0[Xx]/,
        Ap = 8 !== Ep(Gr + "08") || 22 !== Ep(Gr + "0x16") || Cp && !P((function () {
            Ep(Object(Cp))
        })) ? function (e, t) {
            var n = Rp(gr(e));
            return Ep(n, t >>> 0 || (wp.test(n) ? 16 : 10))
        } : Ep;
    Et({
        global: !0,
        forced: parseInt != Ap
    }, {
        parseInt: Ap
    });
    var Pp = Jt.findIndex,
        Dp = !0;
    "findIndex" in [] && Array(1).findIndex((function () {
        Dp = !1
    })), Et({
        target: "Array",
        proto: !0,
        forced: Dp
    }, {
        findIndex: function (e) {
            return Pp(this, e, arguments.length > 1 ? arguments[1] : void 0)
        }
    }), pi("findIndex");
    var xp = P((function () {
        kr(1)
    }));
    Et({
        target: "Object",
        stat: !0,
        forced: xp
    }, {
        keys: function (e) {
            return kr(se(e))
        }
    });
    var Op = N.f,
        Np = function (e) {
            return function (t) {
                for (var n, r = B(t), i = kr(r), a = i.length, o = 0, s = []; a > o;) n = i[o++], D && !Op.call(r, n) || s.push(e ? [n, r[n]] : r[n]);
                return s
            }
        },
        Mp = {
            entries: Np(!0),
            values: Np(!1)
        }.values;
    Et({
        target: "Object",
        stat: !0
    }, {
        values: function (e) {
            return Mp(e)
        }
    });
    var Lp = ct.includes;
    Et({
        target: "Array",
        proto: !0
    }, {
        includes: function (e) {
            return Lp(this, e, arguments.length > 1 ? arguments[1] : void 0)
        }
    }), pi("includes"), Et({
        target: "String",
        proto: !0,
        forced: !Kl("includes")
    }, {
        includes: function (e) {
            return !!~gr(j(this)).indexOf(gr(Wl(e)), arguments.length > 1 ? arguments[1] : void 0)
        }
    });
    var Vp = E((function (e) {
            var t = Object.prototype.hasOwnProperty,
                n = "~";

            function r() {}

            function i(e, t, n) {
                this.fn = e, this.context = t, this.once = n || !1
            }

            function a(e, t, r, a, o) {
                if ("function" != typeof r) throw new TypeError("The listener must be a function");
                var s = new i(r, a || e, o),
                    c = n ? n + t : t;
                return e._events[c] ? e._events[c].fn ? e._events[c] = [e._events[c], s] : e._events[c].push(s) : (e._events[c] = s, e._eventsCount++), e
            }

            function o(e, t) {
                0 == --e._eventsCount ? e._events = new r : delete e._events[t]
            }

            function s() {
                this._events = new r, this._eventsCount = 0
            }
            Object.create && (r.prototype = Object.create(null), (new r).__proto__ || (n = !1)), s.prototype.eventNames = function () {
                var e, r, i = [];
                if (0 === this._eventsCount) return i;
                for (r in e = this._events) t.call(e, r) && i.push(n ? r.slice(1) : r);
                return Object.getOwnPropertySymbols ? i.concat(Object.getOwnPropertySymbols(e)) : i
            }, s.prototype.listeners = function (e) {
                var t = n ? n + e : e,
                    r = this._events[t];
                if (!r) return [];
                if (r.fn) return [r.fn];
                for (var i = 0, a = r.length, o = new Array(a); i < a; i++) o[i] = r[i].fn;
                return o
            }, s.prototype.listenerCount = function (e) {
                var t = n ? n + e : e,
                    r = this._events[t];
                return r ? r.fn ? 1 : r.length : 0
            }, s.prototype.emit = function (e, t, r, i, a, o) {
                var s = n ? n + e : e;
                if (!this._events[s]) return !1;
                var c, u, d = this._events[s],
                    l = arguments.length;
                if (d.fn) {
                    switch (d.once && this.removeListener(e, d.fn, void 0, !0), l) {
                    case 1:
                        return d.fn.call(d.context), !0;
                    case 2:
                        return d.fn.call(d.context, t), !0;
                    case 3:
                        return d.fn.call(d.context, t, r), !0;
                    case 4:
                        return d.fn.call(d.context, t, r, i), !0;
                    case 5:
                        return d.fn.call(d.context, t, r, i, a), !0;
                    case 6:
                        return d.fn.call(d.context, t, r, i, a, o), !0
                    }
                    for (u = 1, c = new Array(l - 1); u < l; u++) c[u - 1] = arguments[u];
                    d.fn.apply(d.context, c)
                } else {
                    var h, p = d.length;
                    for (u = 0; u < p; u++) switch (d[u].once && this.removeListener(e, d[u].fn, void 0, !0), l) {
                    case 1:
                        d[u].fn.call(d[u].context);
                        break;
                    case 2:
                        d[u].fn.call(d[u].context, t);
                        break;
                    case 3:
                        d[u].fn.call(d[u].context, t, r);
                        break;
                    case 4:
                        d[u].fn.call(d[u].context, t, r, i);
                        break;
                    default:
                        if (!c)
                            for (h = 1, c = new Array(l - 1); h < l; h++) c[h - 1] = arguments[h];
                        d[u].fn.apply(d[u].context, c)
                    }
                }
                return !0
            }, s.prototype.on = function (e, t, n) {
                return a(this, e, t, n, !1)
            }, s.prototype.once = function (e, t, n) {
                return a(this, e, t, n, !0)
            }, s.prototype.removeListener = function (e, t, r, i) {
                var a = n ? n + e : e;
                if (!this._events[a]) return this;
                if (!t) return o(this, a), this;
                var s = this._events[a];
                if (s.fn) s.fn !== t || i && !s.once || r && s.context !== r || o(this, a);
                else {
                    for (var c = 0, u = [], d = s.length; c < d; c++)(s[c].fn !== t || i && !s[c].once || r && s[c].context !== r) && u.push(s[c]);
                    u.length ? this._events[a] = 1 === u.length ? u[0] : u : o(this, a)
                }
                return this
            }, s.prototype.removeAllListeners = function (e) {
                var t;
                return e ? (t = n ? n + e : e, this._events[t] && o(this, t)) : (this._events = new r, this._eventsCount = 0), this
            }, s.prototype.off = s.prototype.removeListener, s.prototype.addListener = s.prototype.on, s.prefixed = n, s.EventEmitter = s, e.exports = s
        })),
        Up = "connection-state-changed",
        Fp = "connected",
        jp = "error",
        Bp = "DISCONNECTED",
        Hp = "CONNECTING",
        Gp = "RECONNECTING",
        Jp = "CONNECTED",
        zp = {
            ON_PUBLISH_RESPONSE: 2,
            NEW_ICE_CANDIDATE: 4,
            CLINET_BANNED: 8,
            CHANNEL_SETUP_SUCCESS: 19,
            CHANNEL_SETUP_FAILED: 80,
            REBUILD_SESSION_RESULT: 514,
            JOIN_ROOM_RESULT: 20,
            PEER_JOIN: 4134,
            PEER_LEAVE: 4135,
            STREAM_ADDED: 16,
            STREAM_REMOVED: 18,
            UPDATE_REMOTE_SDP: 48,
            UPDATE_AUDIO_SSRC: 50,
            UPDATE_VIDEO_SSRC: 52,
            UPLINK_NETWORK_STATS: 22,
            UPDATE_REMOTE_MUTE_STAT: 23,
            CLOSE_PEER_ACK: 10,
            SUBSCRIBE_ACK: 26,
            PONG: 775,
            PUBLISH_RESULT: 4098,
            UNPUBLISH_RESULT: 4100,
            SUBSCRIBE_RESULT: 4102,
            UNSUBSCRIBE_RESULT: 4104,
            SUBSCRIBE_CHANGE_RESULT: 4106,
            UPDATE_OFFER_RESULT: 4128,
            REMOTE_STREAM_UPDATE: 4130,
            START_PUBLISH_TENCENT_CDN_RES: 1286,
            STOP_PUBLISH_TENCENT_CDN_RES: 1288,
            START_PUBLISH_GIVEN_CDN_RES: 777,
            STOP_PUBLISH_GIVEN_CDN_RES: 779,
            START_MIX_TRANSCODE_RES: 781,
            STOP_MIX_TRANSCODE_RES: 783,
            USER_LIST_RES: 4137,
            SWITCH_ROLE_RES: 4110
        },
        Wp = [zp.UPDATE_REMOTE_MUTE_STAT, zp.UPLINK_NETWORK_STATS, zp.PONG, zp.REMOTE_STREAM_UPDATE, zp.USER_LIST_RES],
        qp = {
            ON_PUBLISH_RESPONSE: "on-publish-response",
            NEW_ICE_CANDIDATE: "new-ice-candidate",
            CLINET_BANNED: "client-banned",
            CHANNEL_SETUP_SUCCESS: "channel-setup-success",
            CHANNEL_SETUP_FAILED: "channel-setup-failed",
            REBUILD_SESSION_RESULT: "channel-reconnect-result",
            JOIN_ROOM_RESULT: "join-room-result",
            PEER_JOIN: "peer-join",
            PEER_LEAVE: "peer-leave",
            STREAM_ADDED: "stream-added",
            STREAM_REMOVED: "stream-removed",
            UPDATE_REMOTE_SDP: "update-remote-sdp",
            UPDATE_AUDIO_SSRC: "update-audio-ssrc",
            UPDATE_VIDEO_SSRC: "update-video-ssrc",
            UPLINK_NETWORK_STATS: "uplink-network-stats",
            UPDATE_REMOTE_MUTE_STAT: "update-remote-mute-stat",
            CLOSE_PEER_ACK: "close-peer-ack",
            SUBSCRIBE_ACK: "subscribe-ack",
            REQUEST_REBUILD_SESSION: "request-rebuild-session",
            CLIENT_REJOIN: "client-rejoin",
            PONG: "pong",
            PUBLISH_RESULT: "publish-result",
            UNPUBLISH_RESULT: "unpublish-result",
            SUBSCRIBE_RESULT: "subscribe-result",
            SUBSCRIBE_CHANGE_RESULT: "subscribe-change-result",
            UNSUBSCRIBE_RESULT: "unsubscribe-result",
            UPDATE_OFFER_RESULT: "update-offer-result",
            REMOTE_STREAM_UPDATE: "remote-stream-update",
            START_PUBLISH_TENCENT_CDN_RES: "start-publish-tencent-cdn-res",
            STOP_PUBLISH_TENCENT_CDN_RES: "stop-publish-tencent-cdn-res",
            START_PUBLISH_GIVEN_CDN_RES: "start-publish-given-cdn-res",
            STOP_PUBLISH_GIVEN_CDN_RES: "stop-publish-given-cdn-res",
            START_MIX_TRANSCODE_RES: "start-mix-transcode-res",
            STOP_MIX_TRANSCODE_RES: "stop-mix-transcode-res",
            USER_LIST_RES: "user-list-res",
            SWITCH_ROLE_RES: "switch_role_res"
        },
        Kp = "on_update_track",
        Qp = "on_create_room",
        Xp = "on_quit_room",
        Yp = "on_quality_report",
        $p = "on_rebuild_session",
        Zp = "on_mute_uplink",
        ef = "on_constraints_config",
        tf = "ping",
        nf = "on_publish",
        rf = "on_unpublish",
        af = "on_sub",
        of = "on_unsub",
        sf = "on_sub_change",
        cf = "on_start_publishing",
        uf = "on_stop_publishing",
        df = "on_start_push_user_cdn",
        lf = "on_stop_push_user_cdn",
        hf = "on_start_mcu_mix",
        pf = "on_stop_mcu_mix",
        ff = "on_get_user_list",
        mf = "on_switch_role",
        _f = "on_change_video_type",
        vf = 32768,
        gf = 32769,
        Sf = 32770,
        yf = 32771,
        Tf = 32772,
        kf = 32773,
        bf = 32774,
        Rf = 32775,
        Ef = 32777,
        If = 32778,
        Cf = 32779,
        wf = 32780,
        Af = 32781,
        Pf = 32782,
        Df = 32783,
        xf = 32784,
        Of = 32785,
        Nf = 32786,
        Mf = 32787,
        Lf = 32788,
        Vf = 32789,
        Uf = 32790,
        Ff = 32791,
        jf = 32792,
        Bf = 32793,
        Hf = 32794,
        Gf = 32795,
        Jf = 32796,
        zf = 32797,
        Wf = 32798,
        qf = 32799,
        Kf = 32800,
        Qf = 32801,
        Xf = 32802,
        Yf = new Map,
        $f = function (e, t) {
            var n = Yf.get(e);
            n || (Yf.set(e, []), n = Yf.get(e)), n.push(t)
        },
        Zf = function (e) {
            var t = Yf.get(e);
            return t ? Yf.delete(e) : t = [], t
        },
        em = Object.prototype.hasOwnProperty;

    function tm(e) {
        if (null == e) return !0;
        if ("boolean" == typeof e) return !1;
        if ("number" == typeof e) return 0 === e;
        if ("string" == typeof e) return 0 === e.length;
        if ("function" == typeof e) return 0 === e.length;
        if (Array.isArray(e)) return 0 === e.length;
        if (e instanceof Error) return "" === e.message;
        if (wu(e)) switch (Object.prototype.toString.call(e)) {
        case "[object File]":
        case "[object Map]":
        case "[object Set]":
            return 0 === e.size;
        case "[object Object]":
            for (var t in e)
                if (em.call(e, t)) return !1;
            return !0
        }
        return !1
    }
    var nm = /"/g,
        rm = function (e, t, n, r) {
            var i = gr(j(e)),
                a = "<" + t;
            return "" !== n && (a += " " + n + '="' + gr(r).replace(nm, "&quot;") + '"'), a + ">" + i + "</" + t + ">"
        },
        im = function (e) {
            return P((function () {
                var t = "" [e]('"');
                return t !== t.toLowerCase() || t.split('"').length > 3
            }))
        };
    Et({
        target: "String",
        proto: !0,
        forced: im("link")
    }, {
        link: function (e) {
            return rm(this, "a", "href", e)
        }
    });
    var am = "AVOID_REPEATED_CALL",
        om = "INVALID_PARAMETER_REQUIRED",
        sm = "INVALID_PARAMETER_TYPE",
        cm = "INVALID_PARAMETER_EMPTY",
        um = "INVALID_PARAMETER_INSTANCE",
        dm = "INVALID_PARAMETER_RANGE",
        lm = "API_CALL_TIMEOUT",
        hm = "SIGNAL_CHANNEL_RECONNECTION_FAILED",
        pm = "SIGNAL_CHANNEL_SETUP_FAILED",
        fm = "ERROR_MESSAGE",
        mm = "SUBSCRIPTION_TIMEOUT",
        _m = "EXCHANGE_SDP_TIMEOUT",
        vm = "DOWNLINK_RECONNECTION_FAILED",
        gm = "EXCHANGE_SDP_FAILED",
        Sm = "UPLINK_RECONNECTION_FAILED",
        ym = "AUDIO",
        Tm = "VIDEO",
        km = "INVALID_RECORDID",
        bm = "INVALID_PURE_AUDIO",
        Rm = "INVALID_STREAMID",
        Em = "INVALID_USER_DEFINE_RECORDID",
        Im = "INVALID_USER_DEFINE_PUSH_ARGS",
        Cm = "INVALID_PROXY",
        wm = "INVALID_JOIN",
        Am = "INVALID_ROOMID_STRING",
        Pm = "INVALID_ROOMID_INTEGER",
        Dm = "JOIN_ROOM_TIMEOUT",
        xm = "JOIN_ROOM_FAILED",
        Om = "REJOIN_ROOM_FAILED",
        Nm = "INVALID_LEAVE",
        Mm = "INVALID_PUBLISH",
        Lm = "INVALID_UNPUBLISH",
        Vm = "INVALID_AUDIENCE",
        Um = "INVALID_INITIALIZE",
        Fm = "INVALID_DUPLICATE_PUBLISHING",
        jm = "INVALID_REMOTE_STREAM",
        Bm = "SUBSCRIBE_FAILED",
        Hm = "INVALID_ROLE",
        Gm = "INVALID_OPERATION_SWITCH_ROLE",
        Jm = "SWITCH_ROLE_TIMEOUT",
        zm = "SWITCH_ROLE_FAILED",
        Wm = "CLIENT_BANNED",
        qm = "INVALID_OPERATION_START_PUBLISH_CDN",
        Km = "INVALID_OPERATION_STOP_PUBLISH_CDN",
        Qm = "INVALID_PARAMETER_START_PUBLISH_CDN",
        Xm = "START_PUBLISH_CDN_FAILED",
        Ym = "STOP_PUBLISH_CDN_FAILED",
        $m = "START_MIX_TRANSCODE",
        Zm = "STOP_MIX_TRANSCODE",
        e_ = "INVALID_AUDIO_VOLUME",
        t_ = "ENABLE_SMALL_STREAM_PUBLISHED",
        n_ = "DISABLE_SMALL_STREAM_PUBLISHED",
        r_ = "NOT_SUPPORTED_SMALL_STREAM",
        i_ = "INVALID_SMALL_STREAM_PROFILE",
        a_ = "INVALID_PARAMETER_REMOTE_STREAM",
        o_ = "REMOTE_NOT_PUBLISH_SMALL_STREAM",
        s_ = "INVALID_SWITCH_DEVICE",
        c_ = "INVALID_SWITCH_DEVICE_PUBLISHING",
        u_ = "INVALID_REPLACE_TRACK",
        d_ = "INVALID_INITIALIZE_LOCAL_STREAM",
        l_ = "INVALID_ADD_TRACK_REPETITIVE",
        h_ = "INVALID_ADD_TRACK_REMOVING",
        p_ = "INVALID_ADD_TRACK_PUBLISHING",
        f_ = "INVALID_STREAM_INITIALIZED",
        m_ = "INVALID_ADD_TRACK_NUMBER",
        __ = "INVALID_REMOVE_AUDIO_TRACK",
        v_ = "INVALID_REMOVE_AUDIO_ADDING",
        g_ = "INVALID_REMOVE_AUDIO_ON",
        S_ = "INVALID_REMOVE_TRACK_PUBLISHING",
        y_ = "INVALID_REMOVE_TRACK_NOT_PUBLISHING",
        T_ = "INVALID_REMOVE_TRACK_NUMBER",
        k_ = "INVALID_REMOVE_TRACK_NOT_PUBLISHED",
        b_ = "START_MIX_TRANSCODE_TIMEOUT",
        R_ = "START_MIX_TRANSCODE_FAILED",
        E_ = "STOP_MIX_TRANSCODE_TIMEOUT",
        I_ = "STOP_MIX_TRANSCODE_FAILED",
        C_ = "MIX_TRANSCODE_NOT_STARTED",
        w_ = "MIX_TRANSCODE_PARAM",
        A_ = "MIX_PARAMS_USER_ID",
        P_ = "MIX_PARAMS_RECT",
        D_ = "MIX_PARAMS_LOCATION",
        x_ = "MIX_PARAMS_ZORDER",
        O_ = "MIX_PARAMS_VIDEO",
        N_ = "MIX_PARAMS_STREAM",
        M_ = "INVALID_PLAY",
        L_ = "INVALID_CREATE_STREAM_SOURCE",
        V_ = "INVALID_CREATE_STREAM_SCREEN",
        U_ = "INVALID_CREATE_STREAM_AUDIO",
        F_ = "INVALID_CREATE_STREAM_SCREEN_AUDIO",
        j_ = "NOT_SUPPORTED_HTTP",
        B_ = "NOT_SUPPORTED_WEBRTC",
        H_ = "NOT_SUPPORTED_TRTC",
        G_ = "NOT_SUPPORTED_PROFILE",
        J_ = "NOT_SUPPORTED_H264ENCODE",
        z_ = "NOT_SUPPORTED_H264DECODE",
        W_ = "NOT_SUPPORTED_REPLACE_TRACK",
        q_ = "NOT_SUPPORTED_CAPTURE",
        K_ = "MICROPHONE_NOT_FOUND",
        Q_ = "CAMERA_NOT_FOUND",
        X_ = {
            AVOID_REPEATED_CALL: function (e) {
                return "previous ".concat(e.name, "() is ongoing, please avoid repeated calls.")
            }, INVALID_PARAMETER_REQUIRED: function (e) {
                var t = e.key,
                    n = e.rule,
                    r = e.fnName,
                    i = e.value;
                return "'".concat(t || n.name, "' is a required param when calling ").concat(r, "(), received: ").concat(i, ".")
            }, INVALID_PARAMETER_TYPE: function (e) {
                var t = e.key,
                    n = e.rule,
                    r = e.fnName,
                    i = e.value,
                    a = "".concat(t || n.name),
                    o = "";
                return o = Array.isArray(n.type) ? n.type.join("|") : n.type, "'".concat(a, "' must be type of ").concat(o, " when calling ").concat(r, "(), received type: ").concat(Nu(i), ".")
            }, INVALID_PARAMETER_EMPTY: function (e) {
                var t = e.key,
                    n = e.rule,
                    r = e.fnName,
                    i = e.value;
                return "'".concat(t || n.name, "' cannot be '").concat(i, "' when calling ").concat(r, "().")
            }, INVALID_PARAMETER_INSTANCE: function (e) {
                var t = e.key,
                    n = e.rule,
                    r = e.fnName,
                    i = e.value,
                    a = "".concat(t || n.name),
                    o = "".concat(n.instanceOf.name || n.instanceOf);
                return "'".concat(a, "' must be instanceof ").concat(o, " when calling ").concat(r, "(), received type: ").concat(Nu(i), ".")
            }, INVALID_PARAMETER_RANGE: function (e) {
                var t = e.key,
                    n = e.rule,
                    r = e.fnName,
                    i = e.value;
                return "'".concat(t || n.name, "' must be one of ").concat(n.values.join("|"), " when calling ").concat(r, "(), received: ").concat(i, ".")
            }, API_CALL_TIMEOUT: function (e) {
                return "".concat(e.commandDesc || e.command, " timeout observed.")
            }, SIGNAL_CHANNEL_RECONNECTION_FAILED: "signal channel reconnection failed, please check your network.",
            SIGNAL_CHANNEL_SETUP_FAILED: function (e) {
                return "SignalChannel setup failure: (errorCode: ".concat(e.errorCode, ", errorMsg: ").concat(e.errorMsg, " }).")
            }, ERROR_MESSAGE: function (e) {
                var t = "".concat(e.type, " failed");
                return e.message && (t = "".concat(t, ": ").concat(e.message, ".")), t
            }, SUBSCRIPTION_TIMEOUT: "remote server does not respond to the subscription.",
            EXCHANGE_SDP_TIMEOUT: "exchange sdp timeout.",
            DOWNLINK_RECONNECTION_FAILED: "downlink reconnection failed, please check your network and re-join room.",
            EXCHANGE_SDP_FAILED: function (e) {
                return "exchange sdp failed ".concat(e.errMsg, ".")
            }, UPDATE_OFFER_TIMEOUT: "update offer timeout observed.",
            UPLINK_RECONNECTION_FAILED: "uplink reconnection failed, please check your network and publish again.",
            AUDIO: function (e) {
                return e.error.toString() + " <audio>"
            }, VIDEO: function (e) {
                return e.error.toString() + " <video>"
            }, INVALID_RECORDID: "recordId must be an integer number.",
            INVALID_PURE_AUDIO: "pureAudioPushMode must be 1 or 2.",
            INVALID_STREAMID: "streamId must be a sting literal within 64 bytes, and not be empty.",
            INVALID_USER_DEFINE_RECORDID: "userDefineRecordId must be a sting literal contains (a-zA-Z),(0-9), underline and hyphen, within 64 bytes, and not be empty.",
            INVALID_USER_DEFINE_PUSH_ARGS: "userDefinePushArgs must be a sting literal within 256 bytes, and not be empty.",
            INVALID_PROXY: 'proxy server url must start with "wss://".',
            INVALID_JOIN: "duplicate join() called.",
            INVALID_ROOMID_STRING: "roomId must be validate string when useStringRoomId is true.",
            INVALID_ROOMID_INTEGER: "roomId must be a integer between [1, 4294967294] when useStringRoomId is false.",
            INVALID_SIGNAL_CHANNEL: "SignalChannel is not ready yet.",
            JOIN_ROOM_TIMEOUT: "join room timeout.",
            JOIN_ROOM_FAILED: function (e) {
                return "Failed to join room - " + e.error
            }, REJOIN_ROOM_FAILED: function (e) {
                return "reJoin room: ".concat(e.roomId, " failed, please check your network.")
            }, INVALID_LEAVE: "please call leave() before destroy().",
            INVALID_PUBLISH: "please call join() before publish().",
            INVALID_UNPUBLISH: "stream has not been published yet.",
            INVALID_AUDIENCE: "no permission to publish() under live/".concat("audience", ', please call switchRole("').concat("anchor", '") firstly before publish().'),
            INVALID_INITIALIZE: "cannot publish stream because stream is not initialized or is switching device.",
            INVALID_DUPLICATE_PUBLISHING: "duplicate publishing, please unpublish and then re-publish.",
            INVALID_SUBSCRIBE_UNDEFINED: "stream is undefined or null.",
            INVALID_SUBSCRIBE_LOCAL: "stream cannot be LocalStream.",
            INVALID_REMOTE_STREAM: "remoteStream does not exist because it has been unpublished by remote peer.",
            SUBSCRIBE_FAILED: function (e) {
                return "failed to subscribe stream, reason: ".concat(e.message, ".")
            }, INVALID_ROLE: "switchRole can only be called in live mode.",
            INVALID_PARAMETER_SWITCH_ROLE: "role could only be set to a value as ".concat("anchor", " or ").concat("audience", "."),
            INVALID_OPERATION_SWITCH_ROLE: "please call join() before switchRole().",
            SWITCH_ROLE_TIMEOUT: "switchRole timeout.",
            SWITCH_ROLE_FAILED: function (e) {
                return "switchRole failed, errCode: ".concat(e.errCode, " errMsg: ").concat(e.errMsg, ".")
            }, CLIENT_BANNED: function (e) {
                return "client was banned because of " + e.reason + "."
            }, INVALID_OPERATION_START_PUBLISH_CDN: "please call publish() before startPublishCDNStream().",
            INVALID_OPERATION_STOP_PUBLISH_CDN: "please call startPublishCDNStream() before stopPublishCDNStream().",
            INVALID_PARAMETER_START_PUBLISH_CDN: "streamId must be valid string or undefined.",
            START_PUBLISH_CDN_FAILED: function (e) {
                return "startPublishCDNStream failed, errMsg: ".concat(e.message, ".")
            }, STOP_PUBLISH_CDN_FAILED: function (e) {
                return "stopPublishCDNStream failed, errMsg: ".concat(e.message, ".")
            }, START_MIX_TRANSCODE: "please call startMixTranscode() after join().",
            STOP_MIX_TRANSCODE: "please call stopMixTranscode() after startMixTranscode().",
            INVALID_AUDIO_VOLUME: "interval must be a number.",
            ENABLE_SMALL_STREAM_PUBLISHED: "Cannot enable small stream after localStream published.",
            DISABLE_SMALL_STREAM_PUBLISHED: "Cannot disable small stream after localStream published.",
            NOT_SUPPORTED_SMALL_STREAM: "your browser does not support opening small stream.",
            INVALID_SMALL_STREAM_PROFILE: "small stream profile is invalid.",
            INVALID_PARAMETER_REMOTE_STREAM: "remoteStream is invalid.",
            REMOTE_NOT_PUBLISH_SMALL_STREAM: "remote peer does not publish small stream.",
            INVALID_SWITCH_DEVICE: "cannot switch device on current stream.",
            INVALID_SWITCH_DEVICE_PUBLISHING: "cannot switch device when publishing localStream.",
            INVALID_REPLACE_TRACK: "cannot replace track when publishing localStream.",
            INVALID_INITIALIZE_LOCAL_STREAM: "local stream has not initialized yet.",
            INVALID_ADD_TRACK_REPETITIVE: "previous addTrack is ongoing, please avoid repetitive execution.",
            INVALID_ADD_TRACK_REMOVING: "cannot add track when a track is removing.",
            INVALID_ADD_TRACK_PUBLISHING: "cannot add track when publishing localStream.",
            INVALID_STREAM_INITIALIZED: "your local stream haven't been initialized yet.",
            INVALID_ADD_TRACK_NUMBER: "a Stream has at most one audio track and one video track.",
            INVALID_REMOVE_AUDIO_TRACK: "remove audio track is not supported.",
            INVALID_REMOVE_AUDIO_ADDING: "cannot remove track when a track is adding.",
            INVALID_REMOVE_AUDIO_ON: "previous removeTrack is ongoing, please avoid repetitive execution.",
            INVALID_REMOVE_TRACK_PUBLISHING: "cannot remove track when publishing localStream.",
            INVALID_REMOVE_TRACK_NOT_PUBLISHING: "the track to be removed is not being publishing.",
            INVALID_REMOVE_TRACK_NUMBER: "remove the only video track is not supported, please use replaceTrack or muteVideo.",
            INVALID_REMOVE_TRACK_NOT_PUBLISHED: function (e) {
                return "try to replace ".concat(e.kind, " track but there's no previous ").concat(e.kind, " being published.")
            }, START_MIX_TRANSCODE_TIMEOUT: "startMixTranscode timeout.",
            START_MIX_TRANSCODE_FAILED: function (e) {
                return "startMixTranscode failed, errMsg: ".concat(e.errMsg, ".")
            }, STOP_MIX_TRANSCODE_TIMEOUT: "stopMixTranscode timeout.",
            STOP_MIX_TRANSCODE_FAILED: function (e) {
                return "stopMixTranscode failed, errMsg: ".concat(e.errMsg, ".")
            }, MIX_TRANSCODE_NOT_STARTED: "mixTranscode has not been started.",
            MIX_TRANSCODE_PARAM: "param should be object when start mix transcoding.",
            MIX_PARAMS_USER_ID: "userId is required.",
            MIX_PARAMS_RECT: "width and height cannot be less than 0.",
            MIX_PARAMS_LOCATION: "locationX and locationY cannot be less than 0.",
            MIX_PARAMS_ZORDER: "zOrder should between 1 and 15.",
            MIX_PARAMS_VIDEO: "videoWidth and videoHeight cannot be less than 0.",
            MIX_PARAMS_STREAM: "videoWidth and videoHeight of output stream should be contain all mix stream.",
            INVALID_PLAY: "duplicate play() call observed, please stop() firstly.",
            INVALID_USERID: "userId cannot be all spaces.",
            INVALID_CREATE_STREAM_SOURCE: "LocalStream must be created by createStream() with either audio/video or audioSource/videoSource, but can not be mixed with audio/video and audioSource/videoSource.",
            INVALID_CREATE_STREAM_SCREEN: "screen/video cannot be both true.",
            INVALID_CREATE_STREAM_AUDIO: "audio/screenAudio cannot be both true.",
            INVALID_CREATE_STREAM_SCREEN_AUDIO: "when screen is true, screenAudio can be configured.",
            NOT_SUPPORTED_HTTP: "not supported in http protocol, please use https protocol.",
            NOT_SUPPORTED_WEBRTC: "your browser does NOT support WebRTC!",
            NOT_SUPPORTED_TRTC: "your browser does NOT support TRTC! ",
            NOT_SUPPORTED_PROFILE: "your browser does not support setVideoProfile.",
            NOT_SUPPORTED_MEDIA: "your browser does not support navigator.mediaDevices.",
            NOT_SUPPORTED_H264ENCODE: "your device does not support H.264 encoding.",
            NOT_SUPPORTED_H264DECODE: "your device does not support H.264 decoding.",
            NOT_SUPPORTED_REPLACE_TRACK: "replaceTrack is not supported in this browser, please use switchDevice or addTrack instead.",
            NOT_SUPPORTED_CAPTURE: "captureScreen is not supported, please use chrome.",
            MICROPHONE_NOT_FOUND: "no microphone detected, please check your microphone and the configuration on TRTC.createStream.",
            CAMERA_NOT_FOUND: "no camera detected, please check your camera and the configuration on TRTC.createStream."
        },
        Y_ = nc + "module-ErrorCode.html",
        $_ = function () {
            if (!zd()) return !1;
            var e = localStorage.getItem("trtc_error_assistance");
            e && ! function (e) {
                var t = (new Date).getTime() - e.saveTime >= 6048e5;
                return e.saveTime && t
            }(JSON.parse(e)) || (Kd.log("request error info"), function () {
                var e = new XMLHttpRequest;
                if (e.open("GET", "https://web.sdk.qcloud.com/trtc/webrtc/download/trtc-error-assistance.js", !1), e.send(null), 4 === e.readyState && 200 === e.status) {
                    var t = document.createElement("script");
                    t.type = "text/javascript", t.text = e.responseText, document.body.appendChild(t), localStorage.setItem("trtc_error_assistance", JSON.stringify({
                        message: e.responseText,
                        saveTime: (new Date).getTime()
                    })), document.body.removeChild(t)
                }
            }())
        };

    function Z_(e) {
        var t = e.key,
            n = e.data,
            r = e.link,
            i = "",
            a = "",
            o = "";
        tm(n) ? i = X_[t] : Pu(X_[t]) && (i = X_[t](n));
        var s = function () {
                if (window.TRTC_ERROR_INFO && window.TRTC_ERROR_LINK) return {
                    TRTC_ERROR_INFO: window.TRTC_ERROR_INFO,
                    TRTC_ERROR_LINK: window.TRTC_ERROR_LINK
                };
                var e = localStorage.getItem("trtc_error_assistance");
                if (e) {
                    e = JSON.parse(e);
                    var t = document.createElement("script");
                    t.type = "text/javascript", t.text = e.message, document.body.appendChild(t);
                    var n = window.TRTC_ERROR_INFO,
                        r = window.TRTC_ERROR_LINK;
                    return document.body.removeChild(t), {
                        TRTC_ERROR_INFO: n,
                        TRTC_ERROR_LINK: r
                    }
                }
                return {}
            }(),
            c = s.TRTC_ERROR_INFO,
            u = s.TRTC_ERROR_LINK;
        c && c[t] && (tm(n) ? a = c[t] : Pu(c[t]) && (a = c[t](n))), r ? o = nc + "".concat(r.className, ".html#").concat(r.className === Ys ? "." : "").concat(r.fnName) : u && u[t] && (o = nc + u[t]);
        var d = i;
        return d += " " + a, d += a ? o ? "查看文档：" + o : "查看文档：" + Y_ : o ? "Refer to：" + o : "Refer to：" + Y_
    }
    var ev = function () {
            function e(t) {
                a(this, e), this.client_ = t.client, this.sdkAppId_ = t.sdkAppId, this.userId_ = t.userId, this.userSig_ = t.userSig, this.url_ = t.url, this.backupUrl_ = t.backupUrl, this.version_ = t.version, this.urlWithParam_ = "".concat(this.url_, "?sdkAppid=").concat(this.sdkAppId_, "&identifier=").concat(this.userId_, "&userSig=").concat(this.userSig_), this.backupUrlWithParam_ = "".concat(this.backupUrl_, "?sdkAppid=").concat(this.sdkAppId_, "&identifier=").concat(this.userId_, "&userSig=").concat(this.userSig_), this.isConnected_ = !1, this.isConnecting_ = !1, this.socketInUse_ = null, this.socket_ = null, this.backupSocket_ = null, this.backupTimer_ = -1, this.signalInfo_ = {}, this.currentState_ = Bp, this.reconnectionCount_ = 0, this.reconnectionTimer_ = -1, this.seq_ = 0, this.pingPongTimeoutId_ = -1, this.pingTimeoutId_ = -1, this.emitter_ = new Vp
            }
            var t;
            return s(e, [{
                key: "connect",
                value: function () {
                    if (document.getElementById('header-trtcstatus')) {
                        //document.getElementById('header-trtcstatus').innerHTML = '在线'
                        app.trtcStatusValue = '在线'
                        document.getElementById('header-trtcstatus').style.background = '#67c23a'
                        document.getElementById('trtcNotice').innerHTML = '[' + new Date().Format("yyyy-MM-dd hh:mm:ss") + '] trtc已连接'
                    }
                    var e = this;
                    Kd.info("connect to url: ".concat(this.urlWithParam_)), this.emitter_.emit(Up, {
                        prevState: this.currentState_,
                        state: Hp
                    }), this.currentState_ = Hp, this.socket_ = new WebSocket(this.urlWithParam_), this.bindSocket(this.socket_), this.backupTimer_ = setTimeout((function () {
                        e.isConnected_ || (Kd.info("trying to connect to backupUrl"), e.tryConnectBackup())
                    }), 5e3)
                }
            }, {
                key: "tryConnectBackup",
                value: function () {
                    this.backupSocket_ || (this.unbindAndCloseSocket("main"), Kd.debug("try to connect to url: ".concat(this.backupUrlWithParam_)), this.backupSocket_ = new WebSocket(this.backupUrlWithParam_), this.bindSocket(this.backupSocket_))
                }
            }, {
                key: "bindSocket",
                value: function (e) {
                    e.onopen = this.onopen.bind(this), e.onclose = this.onclose.bind(this), e.onerror = this.onerror.bind(this), e.onmessage = this.onmessage.bind(this)
                }
            }, {
                key: "unbindSocket",
                value: function (e) {
                    e.onopen = function () {}, e.onclose = function () {}, e.onerror = function () {}, e.onmessage = function () {}
                }
            }, {
                key: "unbindAndCloseSocket",
                value: function (e) {
                    if ("main" === e) {
                        if (this.socket_) {
                            this.unbindSocket(this.socket_);
                            try {
                                this.socket_.close(1e3)
                            } catch (GS) {}
                            this.socket_ = null
                        }
                    } else if (this.backupSocket_) {
                        this.unbindSocket(this.backupSocket_);
                        try {
                            this.backupSocket_.close(1e3)
                        } catch (GS) {}
                        this.backupSocket_ = null
                    }
                }
            }, {
                key: "clearBackupTimer",
                value: function () {
                    -1 !== this.backupTimer_ && (clearTimeout(this.backupTimer_), this.backupTimer_ = -1)
                }
            }, {
                key: "clearReconnectionTimer",
                value: function () {
                    -1 !== this.reconnectionTimer_ && (clearTimeout(this.reconnectionTimer_), this.reconnectionTimer_ = -1)
                }
            }, {
                key: "onopen",
                value: function (e) {
                    //if (document.getElementById('header-trtcstatus')) {
                    //    document.getElementById('header-trtcstatus').innerHTML = '在线'
                    //    document.getElementById('header-trtcstatus').style.background = '#67c23a'
                    //    document.getElementById('trtcNotice').innerHTML = '[' + new Date().Format("yyyy-MM-dd hh:mm:ss") + '] trtc已连接'
                    //}
                    if (!this.isConnected_) {
                        this.isConnected_ = !0, this.isConnecting_ = !1, this.clearBackupTimer(), e.target === this.socket_ ? (this.unbindAndCloseSocket("backup"), this.socketInUse_ = this.socket_) : (this.unbindAndCloseSocket("main"), this.socketInUse_ = this.backupSocket_);
                        var t = e.target.url;
                        Kd.info("[".concat(this.userId_, "] websocket[").concat(t, "] is connected")), this.emitter_.emit(Up, {
                            prevState: this.currentState_,
                            state: Jp
                        }), this.currentState_ === Hp ? this.addSignalEvent(Ff, "signal channel is connected") : this.currentState_ === Gp && this.addSignalEvent(Gf, "signal channel reconnect success"), this.currentState_ = Jp, this.emitter_.emit(Fp)
                    }
                }
            }, {
                key: "onclose",
                value: function (e) {
                    var t = e.target.url,
                        n = e.target === this.socketInUse_;
                    Kd.info("[".concat(this.userId_, "] websocket[").concat(t, " InUse: ").concat(n, "] is closed with code: ").concat(e.code)), e.target === this.socketInUse_ && (this.isConnected_ = !1, e.wasClean && 1e3 === e.code ? (this.emitter_.emit(Up, {
                        prevState: this.currentState_,
                        state: Bp
                    }), this.currentState_ = Bp, this.addSignalEvent(Uf, "signal channel is disconnected")) : (Kd.warn("[".concat(this.userId_, "] onclose code:").concat(e.code, " reason:").concat(e.reason)), Kd.warn("close current websocket and schedule a reconnect timeout"), this.socketInUse_.onclose = function () {}, this.socketInUse_.close(4011), this.socket_ = this.backupSocket_ = this.socketInUse_ = null, this.reconnect("main")))
                }
            }, {
                key: "onerror",
                value: function (e) {
                    var t = e.target.url;
                    Kd.debug("[".concat(this.userId_, "] websocket[").concat(t, "] error observed")), this.isConnected_ ? e.target === this.socketInUse_ && (this.isConnected_ = !1, this.unbindAndCloseSocket("main"), this.unbindAndCloseSocket("backup"), this.socketInUse_ = null, this.reconnect("main")) : (this.isReconnecting_ || bu({
                        eventType: ks,
                        code: rc.UNKNOWN
                    }), e.target == this.socket_ ? (this.unbindAndCloseSocket("main"), this.reconnect("backup")) : (this.unbindAndCloseSocket("backup"), this.reconnect("main"))), this.isConnecting_ = !1, this.isConnected_ = !1
                }
            }, {
                key: "onmessage",
                value: function (e) {
                    var t = this;
                    if (this.isConnected_) {
                        var n = JSON.parse(e.data),
                            r = n.cmd,
                            i = n.content,
                            a = Object.values(zp),
                            o = Object.keys(zp)[a.indexOf(r)],
                            s = qp[o];
                        if (!Wp.includes(r)) {
                            var c = e.target == this.socket_ ? this.url_ : this.backupUrl_;
                            if (Kd.debug("[".concat(this.userId_, "] websocket[").concat(c, "] received message: ").concat(e.data)), Kd.info("[".concat(this.userId_, "] Received event: [ ").concat(s || "unknown cmd: " + r, " ]")), (s === qp.UPDATE_REMOTE_SDP || s === qp.UPDATE_AUDIO_SSRC || s === qp.UPDATE_VIDEO_SSRC) && i.offersdp) try {
                                var u = JSON.parse(i.offersdp),
                                    d = u.audiossrc,
                                    l = u.videossrc,
                                    h = u.rtxssrc;
                                Kd.info("[".concat(this.userId_, "] ssrc info in offersdp: [ audiossrc: ").concat(d, " videossrc: ").concat(l, " rtxssrc: ").concat(h, " ]"))
                            } catch (m) {}
                        }
                        switch (r) {
                        case zp.CHANNEL_SETUP_SUCCESS:
                            this.signalInfo_.relayIp = i.relayip, this.signalInfo_.relayInnerIp = i.innerip, this.signalInfo_.signalIp = i.signalip, this.signalInfo_.localIp = i.localip, this.signalInfo_.dataPort = i.dataport, this.signalInfo_.stunPort = i.stunport, this.signalInfo_.checkSigSeq = i.checkSigSeq, this.signalInfo_.socketId = i.socketid, this.signalInfo_.tinyId = i.tinyid, this.signalInfo_.openId = i.openid, this.signalInfo_.stunPortList = i.stunportList, !i.stunportList || i.stunportList.length <= 0 ? this.signalInfo_.stunServers = "stun:" + i.relayip + ":" + i.stunport : (this.signalInfo_.stunServers = [], i.stunportList.forEach((function (e) {
                                var n = "stun:" + i.relayip + ":" + e;
                                t.signalInfo_.stunServers.push(n)
                            }))), i.cgiurl && (this.signalInfo_.logCgiUrl = i.cgiurl), i.svrTime && function (e) {
                                fu = e - (new Date).getTime();
                                var t = new Date;
                                t.setTime(e), Kd.info("baseTime from server: " + t + " offset: " + fu)
                            }(i.svrTime), Kd.info("ChannelSetup Success: signalIp:".concat(i.signalip, " relayIp:").concat(i.relayip, " clientIp:").concat(i.localip, " checkSigSeq:").concat(i.checkSigSeq)), Kd.info("start ping pong"), this.startPingPong(), this.isReconnecting_ && (this.reconnectionCount_ = 0, this.clearReconnectionTimer(), 1 === i.rc && this.emitter_.emit(qp.REQUEST_REBUILD_SESSION, {
                                signalInfo: this.signalInfo_
                            })), this.emitter_.emit(s, {
                                signalInfo: this.signalInfo_
                            });
                            break;
                        case zp.REBUILD_SESSION_RESULT:
                            0 === i.result ? (Kd.info("reconnect - rebuild session succeeded"), this.client_.checkConnectionsToReconnect()) : (this.emitter_.emit(qp.CLIENT_REJOIN), Kd.error("reconnect - rebuild session failed: ".concat(JSON.stringify(i))));
                            break;
                        case zp.CHANNEL_SETUP_FAILED:
                            if (!this.isReconnecting_) {
                                var p = "sdkAppId invalid",
                                    f = "";
                                Du(i.errorCode) || (p = i.errorCode, f = i.errorMsg);
                                var m = new ic({
                                    code: rc.SIGNAL_CHANNEL_SETUP_FAILED,
                                    extraCode: p,
                                    message: Z_({
                                        key: pm,
                                        data: {
                                            errorCode: p,
                                            errorMsg: f
                                        }
                                    })
                                });
                                this.close(), bu({
                                    eventType: ks,
                                    error: m
                                }), this.emitter_.emit(jp, m)
                            }
                            break;
                        default:
                            this.emitter_.emit(s, {
                                data: n
                            })
                        }
                    }
                }
            }, {
                key: "addSignalEvent",
                value: function (e, t) {
                    $f(this.userId_, {
                        eventId: e,
                        eventDesc: t,
                        timestamp: mu(),
                        userId: this.userId_,
                        tinyId: this.signalInfo_.tinyId
                    })
                }
            }, {
                key: "reconnect",
                value: function () {
                    if (document.getElementById('header-trtcstatus')) {
                        //document.getElementById('header-trtcstatus').innerHTML = '掉线'
                        app.trtcStatusValue = '掉线'
                        document.getElementById('header-trtcstatus').style.background = 'red'
                        document.getElementById('trtcNotice').innerHTML = '[' + new Date().Format("yyyy-MM-dd hh:mm:ss") + '] trtc正在重连...'
                    }
                    
                    var e = this,
                        t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "main";
                    if (this.isConnecting_ || -1 !== this.reconnectionTimer_) {
                        Kd.info("signal channel is reconnecting, ignoring current reconnection");
                    }else {
                        if (this.reconnectionCount_ >= 30) {
                            Kd.warn("SDK has tried reconnect signal channel for ".concat(30, " times, but all failed. please check your network"));
                            var n = new ic({
                                code: rc.SIGNAL_CHANNEL_RECONNECTION_FAILED,
                                message: Z_({
                                    key: hm
                                })
                            });
                            return bu({
                                eventType: bs,
                                error: n
                            }), this.addSignalEvent(Jf, "signal channel reconnect fail"), void this.emitter_.emit(jp, n)
                        }
                        app.trtcCount++
                        this.isConnecting_ = !0, this.reconnectionCount_++, this.currentState_ !== Gp && (this.emitter_.emit(Up, {
                            prevState: this.currentState_,
                            state: Gp
                        }), this.currentState_ = Gp, this.addSignalEvent(Hf, "signal channel is reconnecting")), Kd.warn("reconnecting to ".concat(t, " signal channel [").concat(this.reconnectionCount_, "/").concat(30, "]"));
                        var r = this.getReconnectionUrl(t);
                        "main" === t ? (this.socket_ = new WebSocket(r), this.bindSocket(this.socket_) ) : (this.backupSocket_ = new WebSocket(r), this.bindSocket(this.backupSocket_));
                        var i = Au(this.reconnectionCount_);
                        this.reconnectionTimer_ = setTimeout((function () {
                            Kd.warn("reconnect ".concat(t, " signal channel timeout(").concat(i / 1e3, "s), close and try again")), e.isConnecting_ = !1, e.clearReconnectionTimer(), e.unbindAndCloseSocket(t), e.reconnect("main" === t ? "backup" : "main")
                        }), i)
                    }
                }
            }, {
                key: "isConnected",
                value: function () {
                    if (this.isConnected_) {
                        if (document.getElementById('header-trtcstatus')) {
                            //document.getElementById('header-trtcstatus').innerHTML = '在线'
                            app.trtcStatusValue = '在线'
                            document.getElementById('header-trtcstatus').style.background = '#67c23a'
                            document.getElementById('trtcNotice').innerHTML = '[' + new Date().Format("yyyy-MM-dd hh:mm:ss") + '] trtc已连接'
                        }
                    }
                    return this.isConnected_
                }
            }, {
                key: "isReconnecting_",
                get: function () {
                    return -1 !== this.reconnectionTimer_
                }
            }, {
                key: "getReconnectionUrl",
                value: function (e) {
                    var t = "main" === e ? this.urlWithParam_ : this.backupUrlWithParam_;
                    return tm(this.signalInfo_) || -1 !== t.indexOf("&rc=1") || (t += "&iip=" + this.signalInfo_.relayInnerIp + "&dp=" + this.signalInfo_.dataPort + "&oip=" + this.signalInfo_.relayIp + "&sp=" + this.signalInfo_.stunPort + "&rc=1"), t
                }
            }, {
                key: "send",
                value: function (e) {
                    var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "",
                        n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;
                    if (this.isConnected_) {
                        var r = this.createSendMessage(e);
                        return r.data = t, void 0 !== n && (r.srctinyid = n), this.socketInUse_.send(JSON.stringify(r)), r.seq
                    } else {
                    
                        //if (document.getElementById('header-trtcstatus')) {
                        //    document.getElementById('header-trtcstatus').innerHTML = '掉线'
                        //    document.getElementById('header-trtcstatus').style.background = 'red'
                        //    document.getElementById('trtcNotice').innerHTML = '[' + new Date().Format("yyyy-MM-dd hh:mm:ss") + '] trtc已断开'
                        //}
                    }
                }
            }, {
                key: "sendWithoutUA",
                value: function (e) {
                    var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "",
                        n = arguments.length > 2 ? arguments[2] : void 0;
                    if (this.isConnected_) {
                        var r = this.createSendMessage(e, !1);
                        return r.data = t, void 0 !== n && (r.srctinyid = n), this.socketInUse_.send(JSON.stringify(r)), r.seq
                    }
                }
            }, {
                key: "sendWithReport",
                value: function (e) {
                    var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "",
                        n = arguments.length > 2 ? arguments[2] : void 0;
                    if (this.isConnected_) {
                        var r = this.createSendMessage(e);
                        return r.data = t, r.report = n, this.socketInUse_.send(JSON.stringify(r)), r.seq
                    }
                }
            }, {
                key: "sendWaitForResponse",
                value: function (e) {
                    var t = this,
                        n = e.command,
                        r = e.data,
                        i = e.timeout,
                        a = void 0 === i ? 5e3 : i,
                        o = e.responseCommand,
                        s = e.commandDesc;
                    return new Promise((function (e, i) {
                        var c = setTimeout((function () {
                                t.off(o, u);
                                var e = new ic({
                                    code: rc.API_CALL_TIMEOUT,
                                    message: Z_({
                                        key: lm,
                                        data: {
                                            error: {
                                                commandDesc: s,
                                                command: n
                                            }
                                        }
                                    })
                                });
                                Kd.warn(e), i(e)
                            }), a),
                            u = function n(r) {
                                r.data.seq === d && (clearTimeout(c), t.off(o, n), e(r))
                            };
                        t.on(o, u);
                        var d = t.send(n, r, 0)
                    }))
                }
            }, {
                key: "startPingPong",
                value: (t = i(regeneratorRuntime.mark((function e() {
                    var t = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (e.prev = 0, -1 === this.pingPongTimeoutId_) {
                                e.next = 3;
                                break
                            }
                            return e.abrupt("return");
                        case 3:
                            return e.next = 5, this.ping();
                        case 5:
                            this.pingPongTimeoutId_ = setTimeout((function () {
                                t.pingPongTimeoutId_ = -1, t.startPingPong()
                            }), 1e4), this.client_.isRelayMaybeFailed() && this.emitter_.emit(qp.CLIENT_REJOIN), e.next = 14;
                            break;
                        case 9:
                            e.prev = 9, e.t0 = e.catch(0), Kd.warn("ping-pong failed, start signal reconnection"), this.close(), this.reconnect("main");
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 9]
                    ])
                }))), function () {
                    return t.apply(this, arguments)
                })
            }, {
                key: "stopPingPong",
                value: function () {
                    Kd.info("stop ping pong"), clearTimeout(this.pingTimeoutId_), clearTimeout(this.pingPongTimeoutId_), this.pingTimeoutId_ = -1, this.pingPongTimeoutId_ = -1
                }
            }, {
                key: "ping",
                value: function () {
                    var e = this;
                    return new Promise((function (t, n) {
                        if (-1 !== e.pingTimeoutId_) return t();
                        e.sendWithoutUA(tf), e.once(qp.PONG, (function () {
                            clearTimeout(e.pingTimeoutId_), e.pingTimeoutId_ = -1, t()
                        })), e.pingTimeoutId_ = setTimeout((function () {
                            e.pingTimeoutId_ = -1, n()
                        }), 1e4)
                    }))
                }
            }, {
                key: "createSendMessage",
                value: function (e) {
                    var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1],
                        n = {
                            tag_key: e,
                            data: "",
                            openid: this.userId_,
                            tinyid: this.signalInfo_.tinyId,
                            version: this.version_,
                            seq: ++this.seq_
                        };
                    return t && (n.ua = navigator.userAgent), n
                }
            }, {
                key: "getCurrentState",
                value: function () {
                    return this.currentState_
                }
            }, {
                key: "getSocketId",
                value: function () {
                    return this.signalInfo_.socketId
                }
            }, {
                key: "close",
                value: function () {
                    //if (document.getElementById('header-trtcstatus')) {
                    //    document.getElementById('header-trtcstatus').innerHTML = '掉线'
                    //    document.getElementById('header-trtcstatus').style.background = 'red'
                    //    document.getElementById('trtcNotice').innerHTML = '[' + new Date().Format("yyyy-MM-dd hh:mm:ss") + '] trtc已断开'
                    //}
                    Kd.info("close SignalChannel"), this.clearBackupTimer(), this.clearReconnectionTimer(), this.stopPingPong(), this.isConnecting_ = !1, this.isConnected_ = !1, this.socketInUse_ = null, this.unbindAndCloseSocket("main"), this.unbindAndCloseSocket("backup")
                }
            }, {
                key: "on",
                value: function (e, t, n) {
                    this.emitter_.on(e, t, n)
                }
            }, {
                key: "removeListener",
                value: function (e, t, n) {
                    this.emitter_.removeListener(e, t, n)
                }
            }, {
                key: "once",
                value: function (e, t, n) {
                    this.emitter_.once(e, t, n)
                }
            }, {
                key: "off",
                value: function (e, t, n) {
                    this.emitter_.off(e, t, n)
                }
            }]), e
        }(),
        tv = Jt.find,
        nv = !0;
    "find" in [] && Array(1).find((function () {
        nv = !1
    })), Et({
        target: "Array",
        proto: !0,
        forced: nv
    }, {
        find: function (e) {
            return tv(this, e, arguments.length > 1 ? arguments[1] : void 0)
        }
    }), pi("find");
    var rv = E((function (e) {
            var t = e.exports = {
                v: [{
                    name: "version",
                    reg: /^(\d*)$/
                }],
                o: [{
                    name: "origin",
                    reg: /^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,
                    names: ["username", "sessionId", "sessionVersion", "netType", "ipVer", "address"],
                    format: "%s %s %d %s IP%d %s"
                }],
                s: [{
                    name: "name"
                }],
                i: [{
                    name: "description"
                }],
                u: [{
                    name: "uri"
                }],
                e: [{
                    name: "email"
                }],
                p: [{
                    name: "phone"
                }],
                z: [{
                    name: "timezones"
                }],
                r: [{
                    name: "repeats"
                }],
                t: [{
                    name: "timing",
                    reg: /^(\d*) (\d*)/,
                    names: ["start", "stop"],
                    format: "%d %d"
                }],
                c: [{
                    name: "connection",
                    reg: /^IN IP(\d) (\S*)/,
                    names: ["version", "ip"],
                    format: "IN IP%d %s"
                }],
                b: [{
                    push: "bandwidth",
                    reg: /^(TIAS|AS|CT|RR|RS):(\d*)/,
                    names: ["type", "limit"],
                    format: "%s:%s"
                }],
                m: [{
                    reg: /^(\w*) (\d*) ([\w/]*)(?: (.*))?/,
                    names: ["type", "port", "protocol", "payloads"],
                    format: "%s %d %s %s"
                }],
                a: [{
                    push: "rtp",
                    reg: /^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,
                    names: ["payload", "codec", "rate", "encoding"],
                    format: function (e) {
                        return e.encoding ? "rtpmap:%d %s/%s/%s" : e.rate ? "rtpmap:%d %s/%s" : "rtpmap:%d %s"
                    }
                }, {
                    push: "fmtp",
                    reg: /^fmtp:(\d*) ([\S| ]*)/,
                    names: ["payload", "config"],
                    format: "fmtp:%d %s"
                }, {
                    name: "control",
                    reg: /^control:(.*)/,
                    format: "control:%s"
                }, {
                    name: "rtcp",
                    reg: /^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,
                    names: ["port", "netType", "ipVer", "address"],
                    format: function (e) {
                        return null != e.address ? "rtcp:%d %s IP%d %s" : "rtcp:%d"
                    }
                }, {
                    push: "rtcpFbTrrInt",
                    reg: /^rtcp-fb:(\*|\d*) trr-int (\d*)/,
                    names: ["payload", "value"],
                    format: "rtcp-fb:%s trr-int %d"
                }, {
                    push: "rtcpFb",
                    reg: /^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,
                    names: ["payload", "type", "subtype"],
                    format: function (e) {
                        return null != e.subtype ? "rtcp-fb:%s %s %s" : "rtcp-fb:%s %s"
                    }
                }, {
                    push: "ext",
                    reg: /^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,
                    names: ["value", "direction", "encrypt-uri", "uri", "config"],
                    format: function (e) {
                        return "extmap:%d" + (e.direction ? "/%s" : "%v") + (e["encrypt-uri"] ? " %s" : "%v") + " %s" + (e.config ? " %s" : "")
                    }
                }, {
                    name: "extmapAllowMixed",
                    reg: /^(extmap-allow-mixed)/
                }, {
                    push: "crypto",
                    reg: /^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,
                    names: ["id", "suite", "config", "sessionConfig"],
                    format: function (e) {
                        return null != e.sessionConfig ? "crypto:%d %s %s %s" : "crypto:%d %s %s"
                    }
                }, {
                    name: "setup",
                    reg: /^setup:(\w*)/,
                    format: "setup:%s"
                }, {
                    name: "connectionType",
                    reg: /^connection:(new|existing)/,
                    format: "connection:%s"
                }, {
                    name: "mid",
                    reg: /^mid:([^\s]*)/,
                    format: "mid:%s"
                }, {
                    name: "msid",
                    reg: /^msid:(.*)/,
                    format: "msid:%s"
                }, {
                    name: "ptime",
                    reg: /^ptime:(\d*(?:\.\d*)*)/,
                    format: "ptime:%d"
                }, {
                    name: "maxptime",
                    reg: /^maxptime:(\d*(?:\.\d*)*)/,
                    format: "maxptime:%d"
                }, {
                    name: "direction",
                    reg: /^(sendrecv|recvonly|sendonly|inactive)/
                }, {
                    name: "icelite",
                    reg: /^(ice-lite)/
                }, {
                    name: "iceUfrag",
                    reg: /^ice-ufrag:(\S*)/,
                    format: "ice-ufrag:%s"
                }, {
                    name: "icePwd",
                    reg: /^ice-pwd:(\S*)/,
                    format: "ice-pwd:%s"
                }, {
                    name: "fingerprint",
                    reg: /^fingerprint:(\S*) (\S*)/,
                    names: ["type", "hash"],
                    format: "fingerprint:%s %s"
                }, {
                    push: "candidates",
                    reg: /^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,
                    names: ["foundation", "component", "transport", "priority", "ip", "port", "type", "raddr", "rport", "tcptype", "generation", "network-id", "network-cost"],
                    format: function (e) {
                        var t = "candidate:%s %d %s %d %s %d typ %s";
                        return t += null != e.raddr ? " raddr %s rport %d" : "%v%v", t += null != e.tcptype ? " tcptype %s" : "%v", null != e.generation && (t += " generation %d"), t += null != e["network-id"] ? " network-id %d" : "%v", t += null != e["network-cost"] ? " network-cost %d" : "%v"
                    }
                }, {
                    name: "endOfCandidates",
                    reg: /^(end-of-candidates)/
                }, {
                    name: "remoteCandidates",
                    reg: /^remote-candidates:(.*)/,
                    format: "remote-candidates:%s"
                }, {
                    name: "iceOptions",
                    reg: /^ice-options:(\S*)/,
                    format: "ice-options:%s"
                }, {
                    push: "ssrcs",
                    reg: /^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,
                    names: ["id", "attribute", "value"],
                    format: function (e) {
                        var t = "ssrc:%d";
                        return null != e.attribute && (t += " %s", null != e.value && (t += ":%s")), t
                    }
                }, {
                    push: "ssrcGroups",
                    reg: /^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,
                    names: ["semantics", "ssrcs"],
                    format: "ssrc-group:%s %s"
                }, {
                    name: "msidSemantic",
                    reg: /^msid-semantic:\s?(\w*) (\S*)/,
                    names: ["semantic", "token"],
                    format: "msid-semantic: %s %s"
                }, {
                    push: "groups",
                    reg: /^group:(\w*) (.*)/,
                    names: ["type", "mids"],
                    format: "group:%s %s"
                }, {
                    name: "rtcpMux",
                    reg: /^(rtcp-mux)/
                }, {
                    name: "rtcpRsize",
                    reg: /^(rtcp-rsize)/
                }, {
                    name: "sctpmap",
                    reg: /^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,
                    names: ["sctpmapNumber", "app", "maxMessageSize"],
                    format: function (e) {
                        return null != e.maxMessageSize ? "sctpmap:%s %s %s" : "sctpmap:%s %s"
                    }
                }, {
                    name: "xGoogleFlag",
                    reg: /^x-google-flag:([^\s]*)/,
                    format: "x-google-flag:%s"
                }, {
                    push: "rids",
                    reg: /^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,
                    names: ["id", "direction", "params"],
                    format: function (e) {
                        return e.params ? "rid:%s %s %s" : "rid:%s %s"
                    }
                }, {
                    push: "imageattrs",
                    reg: new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),
                    names: ["pt", "dir1", "attrs1", "dir2", "attrs2"],
                    format: function (e) {
                        return "imageattr:%s %s %s" + (e.dir2 ? " %s %s" : "")
                    }
                }, {
                    name: "simulcast",
                    reg: new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),
                    names: ["dir1", "list1", "dir2", "list2"],
                    format: function (e) {
                        return "simulcast:%s %s" + (e.dir2 ? " %s %s" : "")
                    }
                }, {
                    name: "simulcast_03",
                    reg: /^simulcast:[\s\t]+([\S+\s\t]+)$/,
                    names: ["value"],
                    format: "simulcast: %s"
                }, {
                    name: "framerate",
                    reg: /^framerate:(\d+(?:$|\.\d+))/,
                    format: "framerate:%s"
                }, {
                    name: "sourceFilter",
                    reg: /^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,
                    names: ["filterMode", "netType", "addressTypes", "destAddress", "srcList"],
                    format: "source-filter: %s %s %s %s %s"
                }, {
                    name: "bundleOnly",
                    reg: /^(bundle-only)/
                }, {
                    name: "label",
                    reg: /^label:(.+)/,
                    format: "label:%s"
                }, {
                    name: "sctpPort",
                    reg: /^sctp-port:(\d+)$/,
                    format: "sctp-port:%s"
                }, {
                    name: "maxMessageSize",
                    reg: /^max-message-size:(\d+)$/,
                    format: "max-message-size:%s"
                }, {
                    push: "tsRefClocks",
                    reg: /^ts-refclk:([^\s=]*)(?:=(\S*))?/,
                    names: ["clksrc", "clksrcExt"],
                    format: function (e) {
                        return "ts-refclk:%s" + (null != e.clksrcExt ? "=%s" : "")
                    }
                }, {
                    name: "mediaClk",
                    reg: /^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,
                    names: ["id", "mediaClockName", "mediaClockValue", "rateNumerator", "rateDenominator"],
                    format: function (e) {
                        var t = "mediaclk:";
                        return t += null != e.id ? "id=%s %s" : "%v%s", t += null != e.mediaClockValue ? "=%s" : "", t += null != e.rateNumerator ? " rate=%s" : "", t += null != e.rateDenominator ? "/%s" : ""
                    }
                }, {
                    name: "keywords",
                    reg: /^keywds:(.+)$/,
                    format: "keywds:%s"
                }, {
                    name: "content",
                    reg: /^content:(.+)/,
                    format: "content:%s"
                }, {
                    name: "bfcpFloorCtrl",
                    reg: /^floorctrl:(c-only|s-only|c-s)/,
                    format: "floorctrl:%s"
                }, {
                    name: "bfcpConfId",
                    reg: /^confid:(\d+)/,
                    format: "confid:%s"
                }, {
                    name: "bfcpUserId",
                    reg: /^userid:(\d+)/,
                    format: "userid:%s"
                }, {
                    name: "bfcpFloorId",
                    reg: /^floorid:(.+) (?:m-stream|mstrm):(.+)/,
                    names: ["id", "mStream"],
                    format: "floorid:%s mstrm:%s"
                }, {
                    push: "invalid",
                    names: ["value"]
                }]
            };
            Object.keys(t).forEach((function (e) {
                t[e].forEach((function (e) {
                    e.reg || (e.reg = /(.*)/), e.format || (e.format = "%s")
                }))
            }))
        })),
        iv = (rv.v, rv.o, rv.s, rv.i, rv.u, rv.e, rv.p, rv.z, rv.r, rv.t, rv.c, rv.b, rv.m, rv.a, E((function (e, t) {
            var n = function (e) {
                    return String(Number(e)) === e ? Number(e) : e
                },
                r = function (e, t, r) {
                    var i = e.name && e.names;
                    e.push && !t[e.push] ? t[e.push] = [] : i && !t[e.name] && (t[e.name] = {});
                    var a = e.push ? {} : i ? t[e.name] : t;
                    ! function (e, t, r, i) {
                        if (i && !r) t[i] = n(e[1]);
                        else
                            for (var a = 0; a < r.length; a += 1) null != e[a + 1] && (t[r[a]] = n(e[a + 1]))
                    }(r.match(e.reg), a, e.names, e.name), e.push && t[e.push].push(a)
                },
                i = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
            t.parse = function (e) {
                var t = {},
                    n = [],
                    a = t;
                return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function (e) {
                    var t = e[0],
                        i = e.slice(2);
                    "m" === t && (n.push({
                        rtp: [],
                        fmtp: []
                    }), a = n[n.length - 1]);
                    for (var o = 0; o < (rv[t] || []).length; o += 1) {
                        var s = rv[t][o];
                        if (s.reg.test(i)) return r(s, a, i)
                    }
                })), t.media = n, t
            };
            var a = function (e, t) {
                var r = t.split(/=(.+)/, 2);
                return 2 === r.length ? e[r[0]] = n(r[1]) : 1 === r.length && t.length > 1 && (e[r[0]] = void 0), e
            };
            t.parseParams = function (e) {
                return e.split(/;\s?/).reduce(a, {})
            }, t.parseFmtpConfig = t.parseParams, t.parsePayloads = function (e) {
                return e.toString().split(" ").map(Number)
            }, t.parseRemoteCandidates = function (e) {
                for (var t = [], r = e.split(" ").map(n), i = 0; i < r.length; i += 3) t.push({
                    component: r[i],
                    ip: r[i + 1],
                    port: r[i + 2]
                });
                return t
            }, t.parseImageAttributes = function (e) {
                return e.split(" ").map((function (e) {
                    return e.substring(1, e.length - 1).split(",").reduce(a, {})
                }))
            }, t.parseSimulcastStreamList = function (e) {
                return e.split(";").map((function (e) {
                    return e.split(",").map((function (e) {
                        var t, r = !1;
                        return "~" !== e[0] ? t = n(e) : (t = n(e.substring(1, e.length)), r = !0), {
                            scid: t,
                            paused: r
                        }
                    }))
                }))
            }
        }))),
        av = (iv.parse, iv.parseParams, iv.parseFmtpConfig, iv.parsePayloads, iv.parseRemoteCandidates, iv.parseImageAttributes, iv.parseSimulcastStreamList, /%[sdv%]/g),
        ov = function (e) {
            var t = 1,
                n = arguments,
                r = n.length;
            return e.replace(av, (function (e) {
                if (t >= r) return e;
                var i = n[t];
                switch (t += 1, e) {
                case "%%":
                    return "%";
                case "%s":
                    return String(i);
                case "%d":
                    return Number(i);
                case "%v":
                    return ""
                }
            }))
        },
        sv = function (e, t, n) {
            var r = [e + "=" + (t.format instanceof Function ? t.format(t.push ? n : n[t.name]) : t.format)];
            if (t.names)
                for (var i = 0; i < t.names.length; i += 1) {
                    var a = t.names[i];
                    t.name ? r.push(n[t.name][a]) : r.push(n[t.names[i]])
                } else r.push(n[t.name]);
            return ov.apply(null, r)
        },
        cv = ["v", "o", "s", "i", "u", "e", "p", "c", "b", "t", "r", "z", "a"],
        uv = ["i", "c", "b", "a"],
        dv = {
            write: function (e, t) {
                t = t || {}, null == e.version && (e.version = 0), null == e.name && (e.name = " "), e.media.forEach((function (e) {
                    null == e.payloads && (e.payloads = "")
                }));
                var n = t.outerOrder || cv,
                    r = t.innerOrder || uv,
                    i = [];
                return n.forEach((function (t) {
                    rv[t].forEach((function (n) {
                        n.name in e && null != e[n.name] ? i.push(sv(t, n, e)) : n.push in e && null != e[n.push] && e[n.push].forEach((function (e) {
                            i.push(sv(t, n, e))
                        }))
                    }))
                })), e.media.forEach((function (e) {
                    i.push(sv("m", rv.m[0], e)), r.forEach((function (t) {
                        rv[t].forEach((function (n) {
                            n.name in e && null != e[n.name] ? i.push(sv(t, n, e)) : n.push in e && null != e[n.push] && e[n.push].forEach((function (e) {
                                i.push(sv(t, n, e))
                            }))
                        }))
                    }))
                })), i.join("\r\n") + "\r\n"
            }, parse: iv.parse,
            parseParams: iv.parseParams,
            parseFmtpConfig: iv.parseFmtpConfig,
            parsePayloads: iv.parsePayloads,
            parseRemoteCandidates: iv.parseRemoteCandidates,
            parseImageAttributes: iv.parseImageAttributes,
            parseSimulcastStreamList: iv.parseSimulcastStreamList
        },
        lv = function (e) {
            return dv.parse(e)
        },
        hv = function (e) {
            return dv.write(e)
        },
        pv = function (e) {
            var t = lv(e);
            return t.media.forEach((function (e) {
                e.type === Fs && e.fmtp.forEach((function (e) {
                    e.config += ";sprop-stereo=1;stereo=1"
                }))
            })), hv(t)
        },
        fv = {
            result: !1,
            detail: {
                isBrowserSupported: !1,
                isWebRTCSupported: !1,
                isMediaDevicesSupported: !1,
                isH264EncodeSupported: !1,
                isVp8EncodeSupported: !1,
                isH264DecodeSupported: !1,
                isVp8DecodeSupported: !1
            }
        },
        mv = function () {
            return !Ed && !Zu && (!(td && nd < 80) && !(Yu && $u < 56))
        },
        _v = function () {
            return ["RTCPeerConnection", "webkitRTCPeerConnection", "RTCIceGatherer"].filter((function (e) {
                return e in window
            })).length > 0
        },
        vv = function () {
            if (!navigator.mediaDevices) return !1;
            var e = ["getUserMedia", "enumerateDevices"];
            return e.filter((function (e) {
                return e in navigator.mediaDevices
            })).length === e.length
        },
        gv = function () {
            var e = i(regeneratorRuntime.mark((function e() {
                var t, n, r, i, a, o;
                return regeneratorRuntime.wrap((function (e) {
                    for (;;) switch (e.prev = e.next) {
                    case 0:
                        if (!fv.detail.isH264EncodeSupported && !fv.detail.isVp8EncodeSupported) {
                            e.next = 2;
                            break
                        }
                        return e.abrupt("return", {
                            isH264EncodeSupported: fv.detail.isH264EncodeSupported,
                            isVp8EncodeSupported: fv.detail.isVp8EncodeSupported
                        });
                    case 2:
                        return t = "", n = !1, r = !1, e.prev = 5, i = new RTCPeerConnection, (a = document.createElement("canvas")).getContext("2d"), o = a.captureStream(0), i.addTrack(o.getVideoTracks()[0], o), e.next = 13, i.createOffer();
                    case 13:
                        return -1 !== (t = e.sent).sdp.toLowerCase().indexOf("h264") && (n = !0), -1 !== t.sdp.toLowerCase().indexOf("vp8") && (r = !0), i.close(), fv.detail.isH264EncodeSupported = n, fv.detail.isVp8EncodeSupported = r, e.abrupt("return", {
                            isH264EncodeSupported: fv.detail.isH264EncodeSupported,
                            isVp8EncodeSupported: fv.detail.isVp8EncodeSupported
                        });
                    case 22:
                        return e.prev = 22, e.t0 = e.catch(5), e.abrupt("return", {
                            isH264EncodeSupported: !1,
                            isVp8EncodeSupported: !1
                        });
                    case 25:
                    case "end":
                        return e.stop()
                    }
                }), e, null, [
                    [5, 22]
                ])
            })));
            return function () {
                return e.apply(this, arguments)
            }
        }();

    function Sv() {
        return yv.apply(this, arguments)
    }

    function yv() {
        return (yv = i(regeneratorRuntime.mark((function e() {
            return regeneratorRuntime.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                case 0:
                    return e.abrupt("return", new Promise(function () {
                        var e = i(regeneratorRuntime.mark((function e(t) {
                            var n, r, a, o, s, c, u, d, l, h, p, f, m, _;
                            return regeneratorRuntime.wrap((function (e) {
                                for (;;) switch (e.prev = e.next) {
                                case 0:
                                    return n = {
                                        encode: !1,
                                        decode: !1
                                    }, r = null, e.prev = 2, a = document.createElement("canvas"), o = a.getContext("2d"), a.width = 640, a.height = 480, s = setInterval((function () {
                                        o.fillText("test", Math.floor(640 * Math.random()), Math.floor(480 * Math.random()))
                                    }), 33), c = -1, u = -1, r = function () {
                                        clearInterval(c), clearInterval(s), clearTimeout(u), l.close(), h.close(), d.getTracks().forEach((function (e) {
                                            return e.stop()
                                        }))
                                    }, u = setTimeout((function () {
                                        r(), t(n)
                                    }), 3e3), d = a.captureStream(), l = new RTCPeerConnection({}), h = new RTCPeerConnection({
                                        offerToReceiveAudio: !0,
                                        offerToReceiveVideo: !0
                                    }), l.addEventListener("icecandidate", (function (e) {
                                        return h.addIceCandidate(e.candidate)
                                    })), h.addEventListener("icecandidate", (function (e) {
                                        return l.addIceCandidate(e.candidate)
                                    })), l.addTrack(d.getVideoTracks()[0], d), e.next = 20, l.createOffer();
                                case 20:
                                    return p = e.sent, e.next = 23, l.setLocalDescription(p);
                                case 23:
                                    return e.next = 25, h.setRemoteDescription(p);
                                case 25:
                                    return e.next = 27, h.createAnswer();
                                case 27:
                                    return f = e.sent, m = lv(f.sdp), _ = m.media[0].rtp.findIndex((function (e) {
                                        return "H264" === e.codec
                                    })), m.media[0].rtp = [m.media[0].rtp[_]], m.media[0].fmtp = m.media[0].fmtp.filter((function (e) {
                                        return e.payload === m.media[0].rtp[0].payload
                                    })), m.media[0].rtcpFb = m.media[0].rtcpFb.filter((function (e) {
                                        return e.payload === m.media[0].rtp[0].payload
                                    })), f.sdp = hv(m), e.next = 36, h.setLocalDescription(f);
                                case 36:
                                    return e.next = 38, l.setRemoteDescription(f);
                                case 38:
                                    c = setInterval(i(regeneratorRuntime.mark((function e() {
                                        var i, a;
                                        return regeneratorRuntime.wrap((function (e) {
                                            for (;;) switch (e.prev = e.next) {
                                            case 0:
                                                return n.encode && n.decode && (r(), t(n)), e.next = 3, l.getStats();
                                            case 3:
                                                return i = e.sent, e.next = 6, h.getStats();
                                            case 6:
                                                a = e.sent, n.encode || i.forEach((function (e) {
                                                    "outbound-rtp" === e.type && e.mediaType === js && e.framesEncoded > 0 && (n.encode = !0)
                                                })), n.decode || a.forEach((function (e) {
                                                    "inbound-rtp" === e.type && e.mediaType === js && e.framesDecoded > 0 && (n.decode = !0)
                                                }));
                                            case 9:
                                            case "end":
                                                return e.stop()
                                            }
                                        }), e)
                                    }))), 500), e.next = 46;
                                    break;
                                case 41:
                                    e.prev = 41, e.t0 = e.catch(2), r(), Kd.warn(e.t0), t(n);
                                case 46:
                                case "end":
                                    return e.stop()
                                }
                            }), e, null, [
                                [2, 41]
                            ])
                        })));
                        return function (t) {
                            return e.apply(this, arguments)
                        }
                    }()));
                case 1:
                case "end":
                    return e.stop()
                }
            }), e)
        })))).apply(this, arguments)
    }
    var Tv = function () {
            var e = i(regeneratorRuntime.mark((function e() {
                var t, n, r, i;
                return regeneratorRuntime.wrap((function (e) {
                    for (;;) switch (e.prev = e.next) {
                    case 0:
                        if (!fv.detail.isH264DecodeSupported && !fv.detail.isVp8DecodeSupported) {
                            e.next = 2;
                            break
                        }
                        return e.abrupt("return", {
                            isH264DecodeSupported: fv.detail.isH264DecodeSupported,
                            isVp8DecodeSupported: fv.detail.isVp8DecodeSupported
                        });
                    case 2:
                        return t = "", n = !1, r = !1, e.prev = 5, i = new RTCPeerConnection, e.next = 9, i.createOffer({
                            offerToReceiveAudio: 1,
                            offerToReceiveVideo: 1
                        });
                    case 9:
                        return -1 !== (t = e.sent).sdp.toLowerCase().indexOf("h264") && (n = !0), -1 !== t.sdp.toLowerCase().indexOf("vp8") && (r = !0), i.close(), e.abrupt("return", {
                            isH264DecodeSupported: n,
                            isVp8DecodeSupported: r
                        });
                    case 16:
                        return e.prev = 16, e.t0 = e.catch(5), e.abrupt("return", {
                            isH264DecodeSupported: !1,
                            isVp8DecodeSupported: !1
                        });
                    case 19:
                    case "end":
                        return e.stop()
                    }
                }), e, null, [
                    [5, 16]
                ])
            })));
            return function () {
                return e.apply(this, arguments)
            }
        }(),
        kv = function () {
            var e = i(regeneratorRuntime.mark((function e() {
                var t, n, r, i, a, o, s, c, u, d, l, h;
                return regeneratorRuntime.wrap((function (e) {
                    for (;;) switch (e.prev = e.next) {
                    case 0:
                        if (!fv.result) {
                            e.next = 2;
                            break
                        }
                        return e.abrupt("return", fv);
                    case 2:
                        return t = mv(), n = _v(), r = vv(), e.next = 7, gv();
                    case 7:
                        return i = e.sent, a = i.isH264EncodeSupported, o = i.isVp8EncodeSupported, e.next = 12, Tv();
                    case 12:
                        if (s = e.sent, c = s.isH264DecodeSupported, u = s.isVp8DecodeSupported, fv.result = t && n && r && (a || o) && (c || u), fv.detail.isBrowserSupported = t, fv.detail.isWebRTCSupported = n, fv.detail.isMediaDevicesSupported = r, fv.detail.isH264EncodeSupported = a, fv.detail.isVp8EncodeSupported = o, fv.detail.isH264DecodeSupported = c, fv.detail.isVp8DecodeSupported = u, !a || !c || !Od && !Md) {
                            e.next = 32;
                            break
                        }
                        return e.next = 26, Sv();
                    case 26:
                        d = e.sent, l = d.encode, h = d.decode, fv.detail.isH264EncodeSupported = l, fv.detail.isH264DecodeSupported = h, l && h || Kd.error("".concat(navigator.userAgent, " isH264EncodeSupported: ").concat(l, " isH264DecodeSupported: ").concat(h));
                    case 32:
                        return fv.result || Kd.error("".concat(navigator.userAgent, " isBrowserSupported: ").concat(t, " ") + "isWebRTCSupported: ".concat(n, " isMediaSupported: ").concat(r, " ") + "isH264EncodeSupported: ".concat(fv.detail.isH264EncodeSupported, " isVp8EncodeSupported: ").concat(o, " ") + "isH264DecodeSupported: ".concat(fv.detail.isH264DecodeSupported, " isVp8DecodeSupported: ").concat(u, " ")), e.abrupt("return", fv);
                    case 34:
                    case "end":
                        return e.stop()
                    }
                }), e)
            })));
            return function () {
                return e.apply(this, arguments)
            }
        }(),
        bv = function () {
            return !(!navigator.mediaDevices || !navigator.mediaDevices.getDisplayMedia)
        },
        Rv = function () {
            return "RTCPeerConnection" in window && "getReceivers" in window.RTCPeerConnection.prototype
        },
        Ev = function () {
            return "RTCPeerConnection" in window && "getSenders" in window.RTCPeerConnection.prototype
        },
        Iv = function () {
            return "RTCRtpTransceiver" in window && "stop" in window.RTCRtpTransceiver.prototype
        },
        Cv = function () {
            return "RTCRtpSender" in window && "setParameters" in window.RTCRtpSender.prototype && Ev()
        },
        wv = function () {
            return !!Du(navigator.mediaDevices) && (Kd.error(X_.NOT_SUPPORTED_MEDIA), !0)
        },
        Av = function () {
            return "http:" === location.protocol && !Jd && (Kd.error(X_.NOT_SUPPORTED_HTTP), !0)
        },
        Pv = function (e) {
            return !("candidate-pair" !== e.type || !e.nominated || "in-progress" !== e.state && "succeeded" !== e.state) && !("boolean" == typeof e.selected && !e.selected)
        },
        Dv = new Map([
            [Qu, "Android"],
            [qu, "iOS"],
            [kd, "Windows"],
            [bd, "MacOS"],
            [Rd, "Linux"]
        ]),
        xv = function () {
            var e = "unknown";
            return Dv.get(!0) && (e = Dv.get(!0)), e
        };

    function Ov() {
        var e = "";
        screen.width && (e += (screen.width ? screen.width * window.devicePixelRatio : "") + " * " + (screen.height ? screen.height * window.devicePixelRatio : ""));
        return e
    }

    function Nv() {
        var e = !1;
        return (navigator.getUserMedia || navigator.mediaDevices && navigator.mediaDevices.getUserMedia) && (e = !0), e
    }

    function Mv() {
        for (var e = {
            isSupported: !1
        }, t = ["AudioContext", "webkitAudioContext", "mozAudioContext", "msAudioContext"], n = 0; n < t.length; n++)
            if (t[n] in window) {
                e.isSupported = !0;
                break
            }
        return e.isSupported
    }

    function Lv() {
        return !ld && !qu && !(!mv() || !("captureStream" in HTMLCanvasElement.prototype))
    }
    kv();
    var Vv = "stream-added",
        Uv = "stream-removed",
        Fv = "stream-updated",
        jv = "stream-subscribed",
        Bv = "error",
        Hv = "connection-state-changed",
        Gv = "stream-added",
        Jv = "stream-removed",
        zv = "stream-updated",
        Wv = "stream-subscribed",
        qv = "connection-state-changed",
        Kv = "peer-join",
        Qv = "peer-leave",
        Xv = "mute-audio",
        Yv = "mute-video",
        $v = "unmute-audio",
        Zv = "unmute-video",
        eg = "client-banned",
        tg = "network-quality",
        ng = "audio-volume",
        rg = "error",
        ig = "player-state-changed",
        ag = "screen-sharing-stopped",
        og = "connection-state-changed",
        sg = "error",
        cg = "player-state-changed",
        ug = function () {
            function e(t) {
                a(this, e), this.prevReport_ = {}, this.prevEncoderImplementation_ = "", this.prevQualityLimitationReason_ = ""
            }
            var t, n, r, o;
            return s(e, [{
                key: "getSenderStats",
                value: (o = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (n = {
                                audio: {
                                    bytesSent: 0,
                                    packetsSent: 0,
                                    audioLevel: 0,
                                    totalAudioEnergy: 0
                                },
                                video: {
                                    bytesSent: 0,
                                    packetsSent: 0,
                                    framesEncoded: 0,
                                    frameWidth: 0,
                                    frameHeight: 0,
                                    framesSent: 0,
                                    fpsCapture: 0,
                                    smallFramesEncoded: 0,
                                    smallFPSCapture: 0,
                                    smallFramesSent: 0
                                },
                                rtt: 0
                            }, r = t.getPeerConnection(), i = t.getSSRC(), !r) {
                                e.next = 14;
                                break
                            }
                            return e.prev = 4, e.next = 7, r.getStats();
                        case 7:
                            e.sent.forEach((function (e) {
                                if ("outbound-rtp" === e.type)
                                    if (e.mediaType === js) {
                                        if (!Yu && Du(e.trackId)) return;
                                        e.ssrc !== i.video || Du(e.encoderImplementation) || a.prevEncoderImplementation_ === e.encoderImplementation || (Kd.debug("[".concat(t.getUserId(), "] encoderImplementation change to ").concat(e.encoderImplementation)), a.prevEncoderImplementation_ = e.encoderImplementation), e.ssrc !== i.video || Du(e.qualityLimitationReason) || a.prevQualityLimitationReason_ === e.qualityLimitationReason || (Kd.debug("[".concat(t.getUserId(), "] qualityLimitationReason change to ").concat(e.qualityLimitationReason)), a.prevQualityLimitationReason_ = e.qualityLimitationReason);
                                        var r = t.getSSRC();
                                        e.ssrc === r.video ? (n.video.bytesSent = e.bytesSent, n.video.packetsSent = e.packetsSent, n.video.framesEncoded = e.framesEncoded) : (n.video.smallBytesSent = e.bytesSent, n.video.smallFramesEncoded = e.framesEncoded)
                                    } else e.mediaType === Fs && (n.audio.bytesSent = e.bytesSent, n.audio.packetsSent = e.packetsSent);
                                else "candidate-pair" === e.type ? Pv(e) && Ou(e.currentRoundTripTime) && (n.rtt = Math.floor(1e3 * e.currentRoundTripTime)) : "track" === e.type ? (Du(e.frameWidth) || (e.trackIdentifier === t.getLocalStreamVideoTrackId() ? (n.video.frameWidth = e.frameWidth, n.video.frameHeight = e.frameHeight, n.video.framesSent = e.framesSent) : (n.video.smallFrameWidth = e.frameWidth, n.video.smallFrameHeight = e.frameHeight, n.video.smallFramesSent = e.framesSent)), Du(e.audioLevel) || (n.audio.audioLevel = e.audioLevel || 0)) : "media-source" === e.type && (e.kind === Fs ? (n.audio.audioLevel = e.audioLevel || 0, n.audio.totalAudioEnergy = e.totalAudioEnergy || 0) : e.kind === js && (e.trackIdentifier === t.getLocalStreamVideoTrackId() ? n.video.fpsCapture = e.framesPerSecond : n.video.smallFPSCapture = e.framesPerSecond))
                            })), e.next = 14;
                            break;
                        case 11:
                            e.prev = 11, e.t0 = e.catch(4), Kd.warn("failed to getStats on sender connection");
                        case 14:
                            return e.abrupt("return", n);
                        case 15:
                        case "end":
                            return e.stop()
                        }
                    }), e, null, [
                        [4, 11]
                    ])
                }))), function (e) {
                    return o.apply(this, arguments)
                })
            }, {
                key: "getReceiverStats",
                value: (r = i(regeneratorRuntime.mark((function e(t) {
                    var n, r;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (n = {
                                tinyId: t.getTinyId(),
                                userId: t.getUserId(),
                                rtt: 0,
                                hasAudio: !1,
                                hasVideo: !1,
                                hasAuxiliary: !1,
                                audio: {
                                    bytesReceived: 0,
                                    packetsReceived: 0,
                                    packetsLost: 0,
                                    jitter: 0,
                                    audioLevel: 0,
                                    totalAudioEnergy: 0
                                },
                                video: {
                                    bytesReceived: 0,
                                    packetsReceived: 0,
                                    packetsLost: 0,
                                    framesReceived: 0,
                                    framesDecoded: 0,
                                    frameWidth: 0,
                                    frameHeight: 0
                                },
                                auxiliary: {
                                    bytesReceived: 0,
                                    packetsReceived: 0,
                                    packetsLost: 0,
                                    framesReceived: 0,
                                    framesDecoded: 0,
                                    frameWidth: 0,
                                    frameHeight: 0
                                }
                            }, !(r = t.getPeerConnection())) {
                                e.next = 13;
                                break
                            }
                            return e.prev = 3, e.next = 6, r.getStats();
                        case 6:
                            e.sent.forEach((function (e) {
                                if ("inbound-rtp" === e.type) {
                                    if (e.mediaType === Fs) n.audio.packetsReceived = e.packetsReceived, n.audio.bytesReceived = e.bytesReceived, n.audio.packetsLost = e.packetsLost, n.audio.jitter = e.jitter, n.hasAudio = !0;
                                    else if (e.mediaType === js) {
                                        if (Yu && 0 === e.bytesReceived) return;
                                        var r = t.getSSRC();
                                        e.ssrc === r.video && (n.video.packetsReceived = e.packetsReceived, n.video.bytesReceived = e.bytesReceived, n.video.packetsLost = e.packetsLost, n.video.framesReceived = e.framesReceived, n.video.framesDecoded = e.framesDecoded, n.video.fpsDecoded = e.framesPerSecond, n.hasVideo = !0), e.ssrc === r.auxiliary && (n.auxiliary.packetsReceived = e.packetsReceived, n.auxiliary.bytesReceived = e.bytesReceived, n.auxiliary.packetsLost = e.packetsLost, n.auxiliary.framesReceived = e.framesReceived, n.auxiliary.framesDecoded = e.framesDecoded, n.auxiliary.fpsDecoded = e.framesPerSecond, n.hasAuxiliary = !0)
                                    }
                                } else "track" === e.type ? (Du(e.frameWidth) || (e.trackIdentifier === t.getMainStreamVideoTrackId() && (n.video.frameWidth = e.frameWidth, n.video.frameHeight = e.frameHeight), e.trackIdentifier === t.getAuxStreamVideoTrackId() && (n.auxiliary.frameWidth = e.frameWidth, n.auxiliary.frameHeight = e.frameHeight)), e.kind === Fs && (n.audio.audioLevel = e.audioLevel || 0, n.audio.totalAudioEnergy = e.totalAudioEnergy || 0)) : "candidate-pair" === e.type && Pv(e) && Ou(e.currentRoundTripTime) && (n.rtt = Math.floor(1e3 * e.currentRoundTripTime))
                            })), e.next = 13;
                            break;
                        case 10:
                            e.prev = 10, e.t0 = e.catch(3), Kd.warn("failed to getStats on receiver connection");
                        case 13:
                            return e.abrupt("return", n);
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, null, [
                        [3, 10]
                    ])
                }))), function (e) {
                    return r.apply(this, arguments)
                })
            }, {
                key: "getStats",
                value: (n = i(regeneratorRuntime.mark((function e(t, n) {
                    var r, i, a, o, s, c, u;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (r = {}, !t) {
                                e.next = 5;
                                break
                            }
                            return e.next = 4, this.getSenderStats(t);
                        case 4:
                            r = e.sent;
                        case 5:
                            i = [], a = k(n), e.prev = 7, a.s();
                        case 9:
                            if ((o = a.n()).done) {
                                e.next = 17;
                                break
                            }
                            return (s = g(o.value, 2))[0], c = s[1], e.next = 13, this.getReceiverStats(c);
                        case 13:
                            u = e.sent, i.push(u);
                        case 15:
                            e.next = 9;
                            break;
                        case 17:
                            e.next = 22;
                            break;
                        case 19:
                            e.prev = 19, e.t0 = e.catch(7), a.e(e.t0);
                        case 22:
                            return e.prev = 22, a.f(), e.finish(22);
                        case 25:
                            return e.abrupt("return", {
                                senderStats: r,
                                receiverStats: i
                            });
                        case 26:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [7, 19, 22, 25]
                    ])
                }))), function (e, t) {
                    return n.apply(this, arguments)
                })
            }, {
                key: "prepareReport",
                value: function (e) {
                    var t = e.stats,
                        n = e.report,
                        r = e.freezeMap;
                    if (!tm(t.senderStats) && (n.uint32_delay = t.senderStats.rtt, n.RTTReportState.uint32_delay = t.senderStats.rtt, n.AudioReportState.sentAudioLevel = t.senderStats.audio.audioLevel, n.AudioReportState.sentAudioEnergy = t.senderStats.audio.totalAudioEnergy, n.AudioReportState.uint32_audio_enc_pkg_br = t.senderStats.audio.bytesSent, n.VideoReportState.uint32_video_snd_br = t.senderStats.video.bytesSent, n.VideoReportState.uint32_send_total_pkg = t.senderStats.video.packetsSent, n.VideoReportState.VideoEncState[0].uint32_enc_width = t.senderStats.video.frameWidth, n.VideoReportState.VideoEncState[0].uint32_enc_height = t.senderStats.video.frameHeight, n.VideoReportState.VideoEncState[0].uint32_enc_fps = t.senderStats.video.framesEncoded, n.VideoReportState.VideoEncState[0].uint32_capture_fps = t.senderStats.video.fpsCapture, n.VideoReportState.VideoEncState[0].uint32_send_fps = t.senderStats.video.framesSent, t.senderStats.video.smallBytesSent)) {
                        n.VideoReportState.uint32_small_video_snd_br = t.senderStats.video.smallBytesSent;
                        var i = {
                            uint32_enc_width: t.senderStats.video.smallFrameWidth || 0,
                            uint32_enc_height: t.senderStats.video.smallFrameHeight || 0,
                            uint32_enc_fps: t.senderStats.video.smallFramesEncoded || 0,
                            uint32_capture_fps: t.senderStats.video.smallFPSCapture || 0,
                            uint32_send_fps: t.senderStats.video.smallFramesSent || 0
                        };
                        n.VideoReportState.VideoEncState.push(i)
                    }
                    t.receiverStats.forEach((function (e) {
                        var t = e.userId;
                        if (n.RTTReportState.RTTDecState.push({
                            uint32_delay: e.rtt,
                            uint64_sender_uin: e.tinyId
                        }), e.hasAudio && (n.AudioReportState.AudioDecState.push({
                            uint32_audio_delay: 0,
                            uint32_audio_jitter: e.audio.jitter,
                            uint32_audio_real_recv_pkg: e.audio.packetsReceived,
                            uint32_audio_flow: e.audio.bytesReceived,
                            uint32_audio_real_recv_br: 0,
                            uint64_sender_uin: e.tinyId,
                            userId: e.userId,
                            packetsLost: e.audio.packetsLost,
                            totalPacketsLost: e.audio.packetsLost,
                            audioLevel: e.audio.audioLevel,
                            audioEnergy: e.audio.totalAudioEnergy
                        }), n.AudioReportState.uint32_audio_real_recv_pkg += e.audio.packetsReceived, n.AudioReportState.uint32_audio_flow += e.audio.bytesReceived, n.uint32_real_num += e.audio.packetsReceived), e.hasVideo) {
                            var i = r.get(t + "_main"),
                                a = i ? i.duration : 0;
                            n.VideoReportState.VideoDecState.push({
                                uint32_video_recv_fps: e.video.framesReceived,
                                uint32_video_dec_fps: e.video.fpsDecoded,
                                uint32_video_recv_br: e.video.bytesReceived,
                                uint32_video_real_recv_pkg: e.video.packetsReceived,
                                uint32_dec_height: e.video.frameHeight,
                                uint32_dec_width: e.video.frameWidth,
                                uint32_video_jitter: 0,
                                uint64_sender_uin: e.tinyId,
                                userId: e.userId,
                                packetsLost: e.video.packetsLost,
                                totalPacketsLost: e.video.packetsLost,
                                uint32_video_strtype: 0,
                                int32_video_freeze_ms: a
                            }), n.VideoReportState.uint32_video_total_real_recv_pkg += e.video.packetsReceived, n.VideoReportState.uint32_video_rcv_br += e.video.bytesReceived
                        }
                        if (e.hasAuxiliary) {
                            var o = r.get(t + "_auxiliary"),
                                s = o ? o.duration : 0;
                            n.VideoReportState.VideoDecState.push({
                                uint32_video_recv_fps: e.auxiliary.framesReceived,
                                uint32_video_dec_fps: e.auxiliary.fpsDecoded,
                                uint32_video_recv_br: e.auxiliary.bytesReceived,
                                uint32_video_real_recv_pkg: e.auxiliary.packetsReceived,
                                uint32_dec_height: e.auxiliary.frameHeight,
                                uint32_dec_width: e.auxiliary.frameWidth,
                                uint32_video_jitter: 0,
                                uint64_sender_uin: e.tinyId,
                                userId: e.userId,
                                packetsLost: e.auxiliary.packetsLost,
                                totalPacketsLost: e.auxiliary.packetsLost,
                                uint32_video_strtype: 2,
                                int32_video_freeze_ms: s
                            })
                        }
                    })), n.uint64_end_utime = (new Date).getTime();
                    var a = this.prevReport_;
                    if (this.prevReport_ = JSON.parse(JSON.stringify(n)), tm(a)) n.AudioReportState.uint32_audio_enc_pkg_br = 8 * n.AudioReportState.uint32_audio_enc_pkg_br / 2, n.VideoReportState.uint32_video_rcv_br = 8 * n.VideoReportState.uint32_video_rcv_br / 2, n.VideoReportState.uint32_video_snd_br = 8 * n.VideoReportState.uint32_video_snd_br / 2, n.VideoReportState.uint32_small_video_snd_br && (n.VideoReportState.uint32_small_video_snd_br = 8 * n.VideoReportState.uint32_small_video_snd_br / 2), n.VideoReportState.VideoDecState.forEach((function (e) {
                        e.uint32_video_recv_br = 8 * e.uint32_video_recv_br / 2, n.uint32_total_send_bps = n.AudioReportState.uint32_audio_enc_pkg_br + n.VideoReportState.uint32_video_snd_br
                    }));
                    else {
                        if (n.uint64_begine_utime = a.uint64_end_utime, n.uint32_real_num -= a.uint32_real_num, n.uint32_real_num <= 0 && (n.uint32_real_num = 0), n.AudioReportState.uint32_audio_real_recv_pkg -= a.AudioReportState.uint32_audio_real_recv_pkg, n.AudioReportState.uint32_audio_real_recv_pkg <= 0 && (n.AudioReportState.uint32_audio_real_recv_pkg = 0), n.AudioReportState.uint32_audio_enc_pkg_br -= a.AudioReportState.uint32_audio_enc_pkg_br, n.AudioReportState.uint32_audio_enc_pkg_br <= 0 && (n.AudioReportState.uint32_audio_enc_pkg_br = 0), n.AudioReportState.uint32_audio_enc_pkg_br = 8 * n.AudioReportState.uint32_audio_enc_pkg_br / 2, n.VideoReportState.uint32_video_snd_br -= a.VideoReportState.uint32_video_snd_br, n.VideoReportState.uint32_video_snd_br <= 0 && (n.VideoReportState.uint32_video_snd_br = 0), n.VideoReportState.uint32_video_snd_br = 8 * n.VideoReportState.uint32_video_snd_br / 2, n.VideoReportState.uint32_small_video_snd_br && (n.VideoReportState.uint32_small_video_snd_br -= a.VideoReportState.uint32_small_video_snd_br, n.VideoReportState.uint32_small_video_snd_br <= 0 && (n.VideoReportState.uint32_small_video_snd_br = 0), n.VideoReportState.uint32_small_video_snd_br = 8 * n.VideoReportState.uint32_small_video_snd_br / 2), n.AudioReportState.uint32_audio_flow -= a.AudioReportState.uint32_audio_flow, n.AudioReportState.uint32_audio_flow <= 0 && (n.AudioReportState.uint32_audio_flow = 0), n.VideoReportState.uint32_send_total_pkg -= a.VideoReportState.uint32_send_total_pkg, n.VideoReportState.uint32_send_total_pkg <= 0 && (n.VideoReportState.uint32_send_total_pkg = 0), n.VideoReportState.uint32_video_rcv_br -= a.VideoReportState.uint32_video_rcv_br, n.VideoReportState.uint32_video_rcv_br <= 0 && (n.VideoReportState.uint32_video_rcv_br = 0), n.VideoReportState.uint32_video_rcv_br = 8 * n.VideoReportState.uint32_video_rcv_br / 2, n.VideoReportState.uint32_video_total_real_recv_pkg -= a.VideoReportState.uint32_video_total_real_recv_pkg, n.VideoReportState.uint32_video_total_real_recv_pkg <= 0 && (n.VideoReportState.uint32_video_total_real_recv_pkg = 0), n.VideoReportState.VideoEncState[0].uint32_enc_fps -= a.VideoReportState.VideoEncState[0].uint32_enc_fps, n.VideoReportState.VideoEncState[0].uint32_enc_fps < 0 && (n.VideoReportState.VideoEncState[0].uint32_enc_fps = 0), n.VideoReportState.VideoEncState[0].uint32_enc_fps = n.VideoReportState.VideoEncState[0].uint32_enc_fps / 2, n.VideoReportState.VideoEncState[0].uint32_send_fps -= a.VideoReportState.VideoEncState[0].uint32_send_fps, n.VideoReportState.VideoEncState[0].uint32_send_fps < 0 && (n.VideoReportState.VideoEncState[0].uint32_send_fps = 0), n.VideoReportState.VideoEncState[0].uint32_send_fps = n.VideoReportState.VideoEncState[0].uint32_send_fps / 2, n.VideoReportState.VideoEncState[1]) {
                            var o = 0,
                                s = 0;
                            a.VideoReportState.VideoEncState[1] && (o = a.VideoReportState.VideoEncState[1].uint32_enc_fps, s = a.VideoReportState.VideoEncState[1].uint32_enc_fps), n.VideoReportState.VideoEncState[1].uint32_enc_fps -= o, n.VideoReportState.VideoEncState[1].uint32_enc_fps < 0 && (n.VideoReportState.VideoEncState[1].uint32_enc_fps = 0), n.VideoReportState.VideoEncState[1].uint32_enc_fps = n.VideoReportState.VideoEncState[1].uint32_enc_fps / 2, n.VideoReportState.VideoEncState[1].uint32_send_fps -= s, n.VideoReportState.VideoEncState[1].uint32_send_fps < 0 && (n.VideoReportState.VideoEncState[1].uint32_send_fps = 0), n.VideoReportState.VideoEncState[1].uint32_send_fps = n.VideoReportState.VideoEncState[1].uint32_send_fps / 2
                        }
                        for (var c = n.VideoReportState.VideoDecState.length, u = 0; u < c; u++) {
                            for (var d = n.VideoReportState.VideoDecState[u], l = d.uint64_sender_uin, h = d.uint32_video_strtype, p = d.uint32_video_real_recv_pkg, f = d.uint32_video_recv_br, m = d.uint32_video_recv_fps, _ = 0; _ < a.VideoReportState.VideoDecState.length; _++) {
                                var v = a.VideoReportState.VideoDecState[_];
                                if (v.uint64_sender_uin === l && v.uint32_video_strtype === h) {
                                    d.packetsLost = d.totalPacketsLost - v.totalPacketsLost, (p -= v.uint32_video_real_recv_pkg) <= 0 && (p = 0), (f -= v.uint32_video_recv_br) <= 0 && (f = 0), (m -= v.uint32_video_recv_fps) < 0 && (m = 0);
                                    break
                                }
                            }
                            n.VideoReportState.VideoDecState[u].uint32_video_real_recv_pkg = p, n.VideoReportState.VideoDecState[u].uint32_video_recv_br = 8 * f / 2, n.VideoReportState.VideoDecState[u].uint32_video_recv_fps = m / 2
                        }
                        c = n.AudioReportState.AudioDecState.length;
                        for (var g = 0; g < c; g++) {
                            for (var S = n.AudioReportState.AudioDecState[g], y = S.uint32_audio_real_recv_pkg, T = S.uint32_audio_flow, k = S.uint64_sender_uin, b = 0; b < a.AudioReportState.AudioDecState.length; b++) {
                                var R = a.AudioReportState.AudioDecState[b];
                                if (R.uint64_sender_uin === k) {
                                    S.packetsLost = S.totalPacketsLost - R.totalPacketsLost, (y -= R.uint32_audio_real_recv_pkg) <= 0 && (y = 0), (T -= R.uint32_audio_flow) <= 0 && (T = 0);
                                    break
                                }
                            }
                            n.AudioReportState.AudioDecState[g].uint32_audio_real_recv_pkg = y, n.AudioReportState.AudioDecState[g].uint32_audio_flow = T, n.AudioReportState.AudioDecState[g].uint32_audio_real_recv_br = 8 * T / 2
                        }
                        n.AudioReportState.uint32_audio_real_recv_br = 8 * n.AudioReportState.uint32_audio_flow / 2, n.uint32_real_num = n.AudioReportState.uint32_audio_real_recv_pkg + n.VideoReportState.uint32_video_total_real_recv_pkg, n.uint32_total_send_bps = n.AudioReportState.uint32_audio_enc_pkg_br + n.VideoReportState.uint32_video_snd_br, n.uint32_total_recv_bps = n.AudioReportState.uint32_audio_real_recv_br + n.VideoReportState.uint32_video_rcv_br
                    }
                    return n
                }
            }, {
                key: "getStatsReport",
                value: (t = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a, o;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return n = t.uplinkConnection, r = t.downlinkConnections, i = t.freezeMap, a = {
                                uint64_begine_utime: (new Date).getTime(),
                                uint64_end_utime: 0,
                                uint32_real_num: 0,
                                uint32_delay: 0,
                                uint32_CPU_curfreq: 0,
                                uint32_total_send_bps: 0,
                                uint32_total_recv_bps: 0,
                                AudioReportState: {
                                    uint32_audio_enc_pkg_br: 0,
                                    uint32_audio_real_recv_pkg: 0,
                                    uint32_audio_flow: 0,
                                    uint32_audio_real_recv_br: 0,
                                    uint32_audio_delay: 0,
                                    uint32_audio_jitter: 0,
                                    uint32_microphone_status: 1,
                                    sentAudioLevel: 0,
                                    sentAudioEnergy: 0,
                                    AudioDecState: []
                                },
                                VideoReportState: {
                                    uint32_video_delay: 0,
                                    uint32_video_snd_br: 0,
                                    uint32_video_total_real_recv_pkg: 0,
                                    uint32_video_rcv_br: 0,
                                    uint32_send_total_pkg: 0,
                                    VideoEncState: [{
                                        uint32_enc_width: 0,
                                        uint32_enc_height: 0,
                                        uint32_capture_fps: 0,
                                        uint32_enc_fps: 0,
                                        uint32_send_fps: 0
                                    }],
                                    VideoDecState: []
                                },
                                RTTReportState: {
                                    uint32_delay: 0,
                                    RTTDecState: []
                                }
                            }, e.next = 4, this.getStats(n, r);
                        case 4:
                            return o = e.sent, this.prepareReport({
                                stats: o,
                                report: a,
                                freezeMap: i
                            }), e.abrupt("return", a);
                        case 7:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return t.apply(this, arguments)
                })
            }]), e
        }(),
        dg = function () {
            function e(t) {
                a(this, e), this.id_ = t.id, this.direction_ = t.direction, this.type_ = t.type, this.directionPrefix_ = "local" === this.direction_ ? "" : "*"
            }
            return s(e, [{
                key: "log",
                value: function (e, t) {
                    Kd[e]("[".concat(this.directionPrefix_).concat(this.id_, "] ").concat(this.type_, " ").concat(t))
                }
            }, {
                key: "info",
                value: function (e) {
                    this.log("info", e)
                }
            }, {
                key: "debug",
                value: function (e) {
                    this.log("debug", e)
                }
            }, {
                key: "warn",
                value: function (e) {
                    this.log("warn", e)
                }
            }, {
                key: "error",
                value: function (e) {
                    this.log("error", e)
                }
            }]), e
        }(),
        lg = new Vp,
        hg = {
            JOIN_START: 1,
            JOIN_SEND_CMD: 2,
            JOIN_RECEIVED_CMD_RES: 3,
            JOIN_SUCCESS: 4,
            JOIN_FAILED: 5,
            LEAVE_START: 20,
            LEAVE_SEND_CMD: 21,
            LEAVE_SUCCESS: 22,
            HEARTBEAT_STATS: 23,
            RECEIVED_PUBLISHED_USER_LIST: 24,
            CALL_STATS: 25,
            PUBLISH_START: 27,
            STREAM_PLAY_SUCCESS: 100,
            PLAYER_STATE_CHANGED: 101,
            VIDEO_PLAYING: 102,
            AUDIO_PLAYING: 103,
            REMOTE_STREAM_TRACK_UPDATED: 110,
            REMOTE_STREAM_ADDED: 111,
            REMOTE_STREAM_SUBSCRIBE_START: 112,
            REMOTE_STREAM_SUBSCRIBED: 113,
            REMOTE_STREAM_UNSUBSCRIBED: 114,
            REMOTE_STREAM_UPDATED: 115,
            REMOTE_STREAM_REMOVED: 116,
            LOCAL_STREAM_PUBLISHED: 120,
            LOCAL_STREAM_INITIALIZE_START: 121,
            LOCAL_STREAM_INITIALIZE_END: 122,
            LOCAL_STREAM_INITIALIZE_FAILED: 123,
            VIDEO_TRACK_MUTED: 130,
            VIDEO_TRACK_UNMUTED: 131,
            PLAY_STREAM_START: 132,
            VIDEO_LOADED_DATA: 133,
            PLAY_VIDEO_START: 134,
            VIDEO_TRACK_ENDED: 135,
            AUDIO_TRACK_MUTED: 136,
            AUDIO_TRACK_ENDED: 137,
            CONNECTION_STATE_CHANGED: 200,
            CONNECTION_SEND_SUBSCRIBE_CMD: 201,
            NETWORK_QUALITY: 300
        },
        pg = function () {
            function e(t) {
                var n = t.signalChannel,
                    r = t.connections,
                    i = t.userId,
                    o = t.client;
                a(this, e), this.client_ = o, this.signalChannel_ = n, this.connections_ = r, this.log_ = new dg({
                    id: "q|" + i,
                    direction: "local",
                    type: ""
                }), this.uplinkConnection_ = null, this.uplinkNetworkQuality_ = 0, this.uplinkRTT_ = 0, this.uplinkLoss_ = 0, this.downlinkNetworkQuality_ = 0, this.downlinkRTT_ = 0, this.downlinkLoss_ = 0, this.downlinkPrevStatMap_ = new Map, this.downlinkLossAndRTTMap_ = new Map, this.interval_ = -1, this.emitter_ = new Vp, this.initialize()
            }
            var t, n;
            return s(e, [{
                key: "uplinkNetworkQuality",
                get: function () {
                    return this.uplinkNetworkQuality_
                }, set: function (e) {
                    e !== this.uplinkNetworkQuality_ && this.log_.info("uplink network quality change ".concat(this.uplinkNetworkQuality, " -> ").concat(e, ", rtt: ").concat(this.uplinkRTT_, ", loss: ").concat(this.uplinkLoss_)), this.uplinkNetworkQuality_ = e
                }
            }, {
                key: "downlinkNetworkQuality",
                get: function () {
                    return this.downlinkNetworkQuality_
                }, set: function (e) {
                    if (e !== this.downlinkNetworkQuality_) {
                        var t = this.getAverageLossAndRTT(S(this.downlinkLossAndRTTMap_.values())),
                            n = t.rtt,
                            r = t.loss;
                        this.log_.info("downlink network quality change ".concat(this.downlinkNetworkQuality, " -> ").concat(e, ", rtt: ").concat(n, ", loss: ").concat(r))
                    }
                    this.downlinkNetworkQuality_ = e
                }
            }, {
                key: "initialize",
                value: function () {
                    var e = this;
                    this.signalChannel_.on(qp.UPLINK_NETWORK_STATS, (function (t) {
                        e.handleUplinkNetworkQuality(t)
                    })), this.signalChannel_.on(Up, this.handleSignalConnectionStateChange.bind(this)), this.start()
                }
            }, {
                key: "handleUplinkNetworkQuality",
                value: function (e) {
                    if (!this.uplinkConnection_) return this.uplinkNetworkQuality = 0, this.uplinkLoss_ = 0, void(this.uplinkRTT_ = 0);
                    var t = this.uplinkConnection_.getPeerConnection();
                    if (t && this.isPeerConnectionDisconnected(t)) return this.uplinkNetworkQuality = 6, this.uplinkLoss_ = 0, void(this.uplinkRTT_ = 0);
                    var n = e.data.content;
                    if (0 === n.result) {
                        var r = n.expectAudPkg + n.expectVidPkg,
                            i = n.recvAudPkg + n.recvVidPkg,
                            a = r - i;
                        if (0 === r && 0 === i) return;
                        this.uplinkLoss_ = a <= 0 ? 0 : Math.round(a / r * 100), this.uplinkRTT_ = n.rtt, this.uplinkNetworkQuality = this.getNetworkQuality(this.uplinkLoss_, this.uplinkRTT_)
                    }
                }
            }, {
                key: "handleDownlinkNetworkQuality",
                value: (n = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i, a, o, s, c, u, d, l, h, p, f, m, _ = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.connections_ && 0 !== this.connections_.size) {
                                e.next = 3;
                                break
                            }
                            return this.downlinkNetworkQuality = 0, e.abrupt("return");
                        case 3:
                            if (t = S(this.connections_.values()), n = t.filter((function (e) {
                                return e.getPeerConnection() && "connected" === e.getPeerConnection().connectionState
                            })), t.filter((function (e) {
                                return e.getPeerConnection() && _.isPeerConnectionDisconnected(e.getPeerConnection())
                            })).length !== t.length) {
                                e.next = 9;
                                break
                            }
                            return this.downlinkNetworkQuality = 6, e.abrupt("return");
                        case 9:
                            r = 0;
                        case 10:
                            if (!(r < n.length)) {
                                e.next = 31;
                                break
                            }
                            return i = n[r].getPeerConnection(), e.next = 14, this.getStat(i);
                        case 14:
                            if (a = e.sent, o = a.rtt, s = a.totalPacketsLost, c = a.totalPacketsReceived, this.downlinkPrevStatMap_.has(i)) {
                                e.next = 21;
                                break
                            }
                            return this.downlinkPrevStatMap_.set(i, {
                                totalPacketsLost: s,
                                totalPacketsReceived: c
                            }), e.abrupt("continue", 28);
                        case 21:
                            u = 0, d = this.downlinkPrevStatMap_.get(i), l = s - d.totalPacketsLost, h = c - d.totalPacketsReceived, u = l <= 0 || h < 0 ? 0 : Math.round(l / (l + h) * 100), this.downlinkPrevStatMap_.set(i, {
                                totalPacketsLost: s,
                                totalPacketsReceived: c
                            }), this.downlinkLossAndRTTMap_.set(i, {
                                rtt: o,
                                loss: u,
                                userId: n[r].getUserId()
                            });
                        case 28:
                            r++, e.next = 10;
                            break;
                        case 31:
                            if (S(this.downlinkPrevStatMap_.keys()).forEach((function (e) {
                                _.isPeerConnectionDisconnected(e) && (_.downlinkPrevStatMap_.delete(e), _.downlinkLossAndRTTMap_.delete(e))
                            })), 0 !== this.downlinkLossAndRTTMap_.size) {
                                e.next = 34;
                                break
                            }
                            return e.abrupt("return");
                        case 34:
                            p = this.getAverageLossAndRTT(S(this.downlinkLossAndRTTMap_.values())), f = p.rtt, m = p.loss, this.downlinkRTT_ = f, this.downlinkLoss_ = m, this.downlinkNetworkQuality = this.getNetworkQuality(m, f);
                        case 38:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return n.apply(this, arguments)
                })
            }, {
                key: "getStat",
                value: (t = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (n = {
                                rtt: 0,
                                totalPacketsLost: 0,
                                totalPacketsReceived: 0
                            }, t && Rv()) {
                                e.next = 3;
                                break
                            }
                            return e.abrupt("return", n);
                        case 3:
                            r = t.getReceivers(), e.prev = 4, i = 0;
                        case 6:
                            if (!(i < r.length)) {
                                e.next = 15;
                                break
                            }
                            return a = r[i], e.next = 10, a.getStats();
                        case 10:
                            e.sent.forEach((function (e) {
                                "candidate-pair" === e.type && Ou(e.currentRoundTripTime) && (n.rtt = Math.round(1e3 * e.currentRoundTripTime)), "inbound-rtp" !== e.type || e.mediaType !== Fs && e.mediaType !== js || (n.totalPacketsLost += e.packetsLost, n.totalPacketsReceived += e.packetsReceived)
                            }));
                        case 12:
                            i++, e.next = 6;
                            break;
                        case 15:
                            return e.abrupt("return", n);
                        case 18:
                            return e.prev = 18, e.t0 = e.catch(4), e.abrupt("return", n);
                        case 21:
                        case "end":
                            return e.stop()
                        }
                    }), e, null, [
                        [4, 18]
                    ])
                }))), function (e) {
                    return t.apply(this, arguments)
                })
            }, {
                key: "getAverageLossAndRTT",
                value: function (e) {
                    var t = {
                        rtt: 0,
                        loss: 0
                    };
                    return Array.isArray(e) && e.length > 0 && (e.forEach((function (e) {
                        t.rtt += e.rtt, t.loss += e.loss
                    })), Object.keys(t).forEach((function (n) {
                        t[n] = Math.round(t[n] / e.length)
                    }))), t
                }
            }, {
                key: "getNetworkQuality",
                value: function (e, t) {
                    return e > 50 || t > 500 ? 5 : e > 30 || t > 350 ? 4 : e > 20 || t > 200 ? 3 : e > 10 || t > 100 ? 2 : e >= 0 || t >= 0 ? 1 : 0
                }
            }, {
                key: "handleSignalConnectionStateChange",
                value: function (e) {
                    e.state === Bp ? (this.uplinkRTT_ = 0, this.uplinkLoss_ = 0, this.uplinkNetworkQuality = 6) : e.state === Jp && 6 === this.uplinkNetworkQuality && (this.uplinkNetworkQuality = 5)
                }
            }, {
                key: "handleUplinkConnectionStateChange",
                value: function (e) {
                    var t = e.state;
                    t === es ? (this.uplinkLoss_ = 0, this.uplinkRTT_ = 0, this.uplinkNetworkQuality = 6) : t === rs && 6 === this.uplinkNetworkQuality && (this.uplinkNetworkQuality = 5)
                }
            }, {
                key: "isPeerConnectionDisconnected",
                value: function (e) {
                    return !(!e || "disconnected" !== e.connectionState && "failed" !== e.connectionState && "closed" !== e.connectionState)
                }
            }, {
                key: "setUplinkConnection",
                value: function (e) {
                    this.uplinkConnection_ = e, this.uplinkConnection_ ? this.uplinkConnection_.on(Hv, this.handleUplinkConnectionStateChange.bind(this)) : (this.uplinkNetworkQuality = 0, this.uplinkRTT_ = 0, this.uplinkLoss_ = 0)
                }
            }, {
                key: "start",
                value: function () {
                    var e = this; - 1 === this.interval_ ? (this.log_.info("start network quality calculating"), this.interval_ = Tl.setInterval((function () {
                        e.handleDownlinkNetworkQuality(), lg.emit(hg.NETWORK_QUALITY, {
                            client: e.client_,
                            uplinkNetworkQuality: e.uplinkNetworkQuality,
                            downlinkNetworkQuality: e.downlinkNetworkQuality,
                            uplinkRTT: e.uplinkRTT_,
                            uplinkLoss: e.uplinkLoss_,
                            downlinkRTT: e.downlinkRTT_,
                            downlinkLoss: e.downlinkLoss_,
                            downlinkLossAndRTTMap: e.downlinkLossAndRTTMap_
                        }), e.emitter_.emit(tg, {
                            uplinkNetworkQuality: e.uplinkNetworkQuality,
                            downlinkNetworkQuality: e.downlinkNetworkQuality,
                            uplinkRTT: e.uplinkRTT_,
                            uplinkLoss: e.uplinkLoss_,
                            downlinkRTT: e.downlinkRTT_,
                            downlinkLoss: e.downlinkLoss_
                        })
                    }), 2e3)) : this.log_.info("network quality calculating is already started")
                }
            }, {
                key: "stop",
                value: function () {
                    this.log_.info("stop network quality calculating"), -1 !== this.interval_ && (Tl.clearInterval(this.interval_), this.interval_ = -1)
                }
            }, {
                key: "on",
                value: function (e, t) {
                    this.emitter_.on(e, t)
                }
            }]), e
        }(),
        fg = function () {
            function e() {
                a(this, e), this.log_ = Kd, this.localStream_ = null, this.prevDevices_ = [], this.initialize()
            }
            var t, n, r;
            return s(e, [{
                key: "initialize",
                value: (r = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            navigator.mediaDevices && navigator.mediaDevices.addEventListener("devicechange", this.onDeviceChange.bind(this));
                        case 1:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return r.apply(this, arguments)
                })
            }, {
                key: "onDeviceChange",
                value: (n = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.localStream_ && this.localStream_.getMediaStream() && !this.localStream_.getScreen()) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return");
                        case 2:
                            return e.next = 4, HS.getDevices();
                        case 4:
                            t = e.sent, n = t.filter((function (e) {
                                return i.prevDevices_.findIndex((function (t) {
                                    var n = t.deviceId;
                                    return e.deviceId === n
                                })) < 0
                            })), r = this.prevDevices_.filter((function (e) {
                                return t.findIndex((function (t) {
                                    var n = t.deviceId;
                                    return e.deviceId === n
                                })) < 0
                            })), n.length > 0 && this.handleDeviceAdded(this.prevDevices_, n), r.length > 0 && this.handleDeviceRemoved(t, r), this.prevDevices_ = t;
                        case 10:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return n.apply(this, arguments)
                })
            }, {
                key: "setLocalStream",
                value: (t = i(regeneratorRuntime.mark((function e(t) {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!t) {
                                e.next = 4;
                                break
                            }
                            return e.next = 3, HS.getDevices();
                        case 3:
                            this.prevDevices_ = e.sent;
                        case 4:
                            this.localStream_ = t;
                        case 5:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return t.apply(this, arguments)
                })
            }, {
                key: "handleDeviceAdded",
                value: function (e, t) {
                    this.log_.warn("devicesAdded: ".concat(JSON.stringify(t))), this.localStream_.updateDeviceIdInUse();
                    var n = t.filter((function (e) {
                            return "videoinput" === e.kind
                        })),
                        r = t.filter((function (e) {
                            return "audioinput" === e.kind
                        })),
                        i = e.filter((function (e) {
                            return "videoinput" === e.kind
                        })),
                        a = e.filter((function (e) {
                            return "audioinput" === e.kind
                        })),
                        o = n.length > 0 && 0 === i.length && this.localStream_.getVideo(),
                        s = r.length > 0 && 0 === a.length && this.localStream_.getAudio();
                    if (s && o) return this.log_.info("new microphone and camera detected, but there was no device before."), void this.localStream_.updateStream({
                        audio: !0,
                        video: !0,
                        cameraId: n[0].deviceId,
                        microphoneId: r[0].deviceId
                    });
                    o && (this.log_.info("new camera detected, but there was no camera before."), this.localStream_.updateStream({
                        audio: !1,
                        video: !0,
                        cameraId: n[0].deviceId
                    })), s && (this.log_.info("new microphone detected, but there was no microphone before."), this.localStream_.updateStream({
                        audio: !0,
                        video: !1,
                        microphoneId: r[0].deviceId
                    }))
                }
            }, {
                key: "handleDeviceRemoved",
                value: function (e, t) {
                    this.log_.warn("devicesRemoved: ".concat(JSON.stringify(t))), this.localStream_.updateDeviceIdInUse();
                    var n = !1,
                        r = !1,
                        i = this.localStream_.getCameraId(),
                        a = this.localStream_.getMicrophoneId();
                    if ("default" === a) {
                        var o = this.localStream_.getMicrophoneGroupId(),
                            s = e.filter((function (e) {
                                return "default" === e.deviceId && "audioinput" === e.kind
                            }))[0];
                        s && s.groupId !== o && (r = !0)
                    }
                    if (t.forEach((function (e) {
                        var t = e.deviceId;
                        i.length > 0 && t === i ? n = !0 : a.length > 0 && t === a && (r = !0)
                    })), n && r) return this.log_.warn("current camera and microphone in use is lost, cameraId: ".concat(i, ", microphoneId: ").concat(a)), void((this.localStream_.getAudio() || this.localStream_.getVideo()) && this.localStream_.updateStream({
                        video: !0,
                        audio: !0
                    }));
                    n && (this.log_.warn("current camera in use is lost, deviceId: ".concat(i)), this.localStream_.getVideo() && this.localStream_.updateStream({
                        video: !0,
                        audio: !1
                    })), r && (this.log_.warn("current microphone in use is lost, deviceId: ".concat(a)), this.localStream_.getAudio() && this.localStream_.updateStream({
                        video: !1,
                        audio: !0
                    }))
                }
            }]), e
        }(),
        mg = 1..toFixed,
        _g = Math.floor,
        vg = function (e, t, n) {
            return 0 === t ? n : t % 2 == 1 ? vg(e, t - 1, n * e) : vg(e * e, t / 2, n)
        },
        gg = function (e, t, n) {
            for (var r = -1, i = n; ++r < 6;) i += t * e[r], e[r] = i % 1e7, i = _g(i / 1e7)
        },
        Sg = function (e, t) {
            for (var n = 6, r = 0; --n >= 0;) r += e[n], e[n] = _g(r / t), r = r % t * 1e7
        },
        yg = function (e) {
            for (var t = 6, n = ""; --t >= 0;)
                if ("" !== n || 0 === t || 0 !== e[t]) {
                    var r = String(e[t]);
                    n = "" === n ? r : n + al.call("0", 7 - r.length) + r
                }
            return n
        },
        Tg = mg && ("0.000" !== 8e-5.toFixed(3) || "1" !== .9.toFixed(0) || "1.25" !== 1.255.toFixed(2) || "1000000000000000128" !== (0xde0b6b3a7640080).toFixed(0)) || !P((function () {
            mg.call({})
        }));
    Et({
        target: "Number",
        proto: !0,
        forced: Tg
    }, {
        toFixed: function (e) {
            var t, n, r, i, a = wo(this),
                o = et(e),
                s = [0, 0, 0, 0, 0, 0],
                c = "",
                u = "0";
            if (o < 0 || o > 20) throw RangeError("Incorrect fraction digits");
            if (a != a) return "NaN";
            if (a <= -1e21 || a >= 1e21) return String(a);
            if (a < 0 && (c = "-", a = -a), a > 1e-21)
                if (n = (t = function (e) {
                    for (var t = 0, n = e; n >= 4096;) t += 12, n /= 4096;
                    for (; n >= 2;) t += 1, n /= 2;
                    return t
                }(a * vg(2, 69, 1)) - 69) < 0 ? a * vg(2, -t, 1) : a / vg(2, t, 1), n *= 4503599627370496, (t = 52 - t) > 0) {
                    for (gg(s, 0, n), r = o; r >= 7;) gg(s, 1e7, 0), r -= 7;
                    for (gg(s, vg(10, r, 1), 0), r = t - 1; r >= 23;) Sg(s, 1 << 23), r -= 23;
                    Sg(s, 1 << r), gg(s, 1, 1), Sg(s, 2), u = yg(s)
                } else gg(s, 0, n), gg(s, 1 << -t, 0), u = yg(s) + al.call("0", o);
            return u = o > 0 ? c + ((i = u.length) <= o ? "0." + al.call("0", o - i) + u : u.slice(0, i - o) + "." + u.slice(i - o)) : c + u
        }
    });
    var kg, bg, Rg, Eg = window.AudioContext || window.webkitAudioContext,
        Ig = null,
        Cg = function () {
            function e() {
                var t = this;
                a(this, e), Ig || (Ig = new Eg), this.context_ = Ig, this.instant_ = 0, this.slow_ = 0, this.clip_ = 0, this.script_ = this.context_.createScriptProcessor(2048, 1, 1), this.script_.onaudioprocess = function (e) {
                    var n, r = e.inputBuffer.getChannelData(0),
                        i = 0,
                        a = 0;
                    for (n = 0; n < r.length; ++n) i += r[n] * r[n], Math.abs(r[n]) > .99 && (a += 1);
                    t.instant_ = Math.sqrt(i / r.length), t.slow_ = .95 * t.slow_ + .05 * t.instant_, t.clip_ = a / r.length
                }
            }
            return s(e, [{
                key: "connectToSource",
                value: function (e, t) {
                    try {
                        var n = new MediaStream;
                        n.addTrack(e), this.mic_ = this.context_.createMediaStreamSource(n), this.mic_.connect(this.script_), this.script_.connect(this.context_.destination), Du(t) || t(null)
                    } catch (GS) {
                        Kd.error("soundMeter connectToSource error: " + GS), Du(t) || t(GS)
                    }
                }
            }, {
                key: "stop",
                value: function () {
                    this.mic_.disconnect(), this.script_.disconnect()
                }
            }, {
                key: "resume",
                value: function () {
                    this.context_ && this.context_.resume()
                }
            }, {
                key: "getVolume",
                value: function () {
                    return this.instant_.toFixed(2)
                }
            }]), e
        }(),
        wg = function () {
            function e(t) {
                a(this, e), this.stream_ = t.stream, this.userId_ = t.stream.getUserId(), this.log_ = this.stream_.getIDLogger(), this.track_ = t.track, this.div_ = t.div, this.muted_ = t.muted, this.outputDeviceId_ = t.outputDeviceId, this.volume_ = t.volume, this.emitter_ = new Vp, this.initializeElement(), this.state_ = "NONE", this.soundMeter_ = null
            }
            var t, n, r, o;
            return s(e, [{
                key: "initializeElement",
                value: function () {
                    var e = new MediaStream;
                    e.addTrack(this.track_);
                    var t = document.createElement(Fs);
                    t.srcObject = e, t.muted = this.muted_, t.setAttribute("id", "audio_".concat(this.stream_.getId())), t.setAttribute("autoplay", "autoplay"), t.setAttribute("playsinline", "playsinline"), this.div_.appendChild(t), this.element_ = t, this.handleEvents()
                }
            }, {
                key: "play",
                value: (o = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!this.outputDeviceId_) {
                                e.next = 3;
                                break
                            }
                            return e.next = 3, this.element_.setSinkId(this.outputDeviceId_);
                        case 3:
                            return this.setVolume(this.volume_), e.prev = 4, e.next = 7, this.element_.play();
                        case 7:
                            e.next = 15;
                            break;
                        case 9:
                            if (e.prev = 9, e.t0 = e.catch(4), this.log_.warn("<audio> play() error: " + e.t0), !(t = e.t0.toString() + " <audio>").startsWith("NotAllowedError")) {
                                e.next = 15;
                                break
                            }
                            throw new ic({
                                code: rc.PLAY_NOT_ALLOWED,
                                message: t
                            });
                        case 15:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [4, 9]
                    ])
                }))), function () {
                    return o.apply(this, arguments)
                })
            }, {
                key: "handleEvents",
                value: function () {
                    this.handleElementEvent = this.handleElementEvent.bind(this), this.handleTrackEvent = this.handleTrackEvent.bind(this), this.element_.addEventListener("playing", this.handleElementEvent), this.element_.addEventListener("ended", this.handleElementEvent), this.element_.addEventListener("pause", this.handleElementEvent), this.element_.addEventListener("error", this.handleElementEvent), this.track_.addEventListener("ended", this.handleTrackEvent), this.track_.addEventListener("mute", this.handleTrackEvent), this.track_.addEventListener("unmute", this.handleTrackEvent)
                }
            }, {
                key: "handleElementEvent",
                value: (r = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a, o, s = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            n = t.type, e.t0 = n, e.next = "playing" === e.t0 ? 4 : "ended" === e.t0 ? 9 : "pause" === e.t0 ? 12 : "error" === e.t0 ? 16 : 27;
                            break;
                        case 4:
                            return this.log_.info("stream - audio player is starting playing"), this.state_ = "PLAYING", lg.emit(hg.AUDIO_PLAYING, {
                                stream: this.stream_
                            }), this.emitter_.emit(cg, {
                                state: this.state_,
                                reason: "playing"
                            }), e.abrupt("break", 27);
                        case 9:
                            return this.log_.info("stream - audio player is ended"), "STOPPED" !== this.state_ && (this.state_ = "STOPPED", this.emitter_.emit(cg, {
                                state: this.state_,
                                reason: "ended"
                            })), e.abrupt("break", 27);
                        case 12:
                            return this.log_.info("stream - audio player is paused"), this.state_ = "PAUSED", this.emitter_.emit(cg, {
                                state: this.state_,
                                reason: "pause"
                            }), e.abrupt("break", 27);
                        case 16:
                            if (!this.element_ || !this.element_.error) {
                                e.next = 26;
                                break
                            }
                            return r = "".concat(xv(), "/").concat(qd().name, "/").concat(qd().version), e.next = 20, HS.getSpeakers();
                        case 20:
                            i = e.sent, a = i[0].label, (o = i.find((function (e) {
                                return e.deviceId === s.outputDeviceId_
                            }))) && (a = o.label), this.log_.error("stream - audio player error observed. code: ".concat(this.element_.error.code, " message: ").concat(this.element_.error.message, " deviceInfo: ").concat(r, " speaker: ").concat(a)), Su("stat-".concat(this.stream_.getType(), "-audio-").concat(ws, "-").concat(this.element_.error.code, "-").concat(r, "-").concat(a), this.element_.error);
                        case 26:
                            return e.abrupt("break", 27);
                        case 27:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return r.apply(this, arguments)
                })
            }, {
                key: "handleTrackEvent",
                value: function (e) {
                    var t = e.type;
                    switch (t) {
                    case "ended":
                        this.log_.info("stream - audio player track is ended"), "STOPPED" !== this.state_ && (this.state_ = "STOPPED", this.emitter_.emit(cg, {
                            state: this.state_,
                            reason: "ended"
                        })), lg.emit(hg.AUDIO_TRACK_ENDED, {
                            stream: this.stream_,
                            type: t
                        });
                        break;
                    case "mute":
                        this.log_.info("stream - audio track is unable to provide media output"), "PAUSED" !== this.state_ && (this.state_ = "PAUSED", this.emitter_.emit(cg, {
                            state: this.state_,
                            reason: "mute"
                        })), lg.emit(hg.AUDIO_TRACK_MUTED, {
                            stream: this.stream_,
                            type: t
                        });
                        break;
                    case "unmute":
                        this.log_.info("stream - audio track is able to provide media output"), "PAUSED" === this.state_ && (this.state_ = "PLAYING", this.emitter_.emit(cg, {
                            state: this.state_,
                            reason: "unmute"
                        }))
                    }
                }
            }, {
                key: "unbindEvents",
                value: function () {
                    this.element_ && (this.element_.removeEventListener("playing", this.handleElementEvent), this.element_.removeEventListener("ended", this.handleElementEvent), this.element_.removeEventListener("pause", this.handleElementEvent), this.element_.removeEventListener("error", this.handleElementEvent)), this.track_ && (this.track_.removeEventListener("ended", this.handleTrackEvent), this.track_.removeEventListener("mute", this.handleTrackEvent), this.track_.removeEventListener("unmute", this.handleTrackEvent))
                }
            }, {
                key: "setSinkId",
                value: (n = i(regeneratorRuntime.mark((function e(t) {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.outputDeviceId_ === t) {
                                e.next = 4;
                                break
                            }
                            return e.next = 3, this.element_.setSinkId(t);
                        case 3:
                            this.outputDeviceId_ = t;
                        case 4:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return n.apply(this, arguments)
                })
            }, {
                key: "setVolume",
                value: function (e) {
                    this.log_.info("stream - audioElement setVolume to : ".concat(e)), this.element_.volume = e
                }
            }, {
                key: "getAudioLevel",
                value: function () {
                    return this.soundMeter_ || (this.soundMeter_ = new Cg, this.soundMeter_.connectToSource(this.track_)), this.soundMeter_.getVolume()
                }
            }, {
                key: "stop",
                value: function () {
                    this.unbindEvents(), this.div_.removeChild(this.element_), this.element_.srcObject = null, this.soundMeter_ && (this.soundMeter_.stop(), this.soundMeter_ = null), this.element_ = null
                }
            }, {
                key: "resume",
                value: (t = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, this.soundMeter_ && this.soundMeter_.resume(), e.next = 4, this.element_.play();
                        case 4:
                            e.next = 12;
                            break;
                        case 6:
                            if (e.prev = 6, e.t0 = e.catch(0), this.log_.warn("<audio> play() error: " + e.t0), !(t = Z_({
                                key: ym,
                                data: {
                                    error: e.t0
                                }
                            })).startsWith("NotAllowedError")) {
                                e.next = 12;
                                break
                            }
                            throw new ic({
                                code: rc.PLAY_NOT_ALLOWED,
                                message: t
                            });
                        case 12:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 6]
                    ])
                }))), function () {
                    return t.apply(this, arguments)
                })
            }, {
                key: "on",
                value: function (e, t) {
                    this.emitter_.on(e, t)
                }
            }]), e
        }(),
        Ag = function () {
            function e(t) {
                a(this, e), this.stream_ = t.stream, this.userId_ = t.stream.getUserId(), this.log_ = this.stream_.getIDLogger(), this.track_ = t.track, this.div_ = t.div, this.muted_ = t.muted, this.objectFit_ = t.objectFit, this.mirror_ = t.mirror, this.emitter_ = new Vp, this.initializeElement(), this.state_ = "NONE", this.pausedRetryCount_ = 5
            }
            var t, n;
            return s(e, [{
                key: "initializeElement",
                value: function () {
                    var e = new MediaStream;
                    e.addTrack(this.track_);
                    var t = document.createElement(js);
                    t.srcObject = e, t.muted = !0;
                    var n = "width: 100%; height: 100%; object-fit: ".concat(this.objectFit_, ";");
                    this.mirror_ && (n += "transform: rotateY(180deg);"), t.setAttribute("id", "video_".concat(this.stream_.getId())), t.setAttribute("style", n), t.setAttribute("autoplay", "autoplay"), t.setAttribute("playsinline", "playsinline"), this.div_.appendChild(t), this.element_ = t, this.handleEvents()
                }
            }, {
                key: "play",
                value: (n = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, e.next = 3, this.element_.play();
                        case 3:
                            e.next = 11;
                            break;
                        case 5:
                            if (e.prev = 5, e.t0 = e.catch(0), this.log_.warn("<video> play() error: " + e.t0), !(t = e.t0.toString() + " <video>").startsWith("NotAllowedError")) {
                                e.next = 11;
                                break
                            }
                            throw new ic({
                                code: rc.PLAY_NOT_ALLOWED,
                                message: t
                            });
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 5]
                    ])
                }))), function () {
                    return n.apply(this, arguments)
                })
            }, {
                key: "handleEvents",
                value: function () {
                    this.handleElementEvent = this.handleElementEvent.bind(this), this.handleTrackEvent = this.handleTrackEvent.bind(this), this.element_.addEventListener("playing", this.handleElementEvent), this.element_.addEventListener("ended", this.handleElementEvent), this.element_.addEventListener("pause", this.handleElementEvent), this.element_.addEventListener("error", this.handleElementEvent), this.element_.addEventListener("loadeddata", this.handleElementEvent), this.track_.addEventListener("ended", this.handleTrackEvent), this.track_.addEventListener("mute", this.handleTrackEvent), this.track_.addEventListener("unmute", this.handleTrackEvent)
                }
            }, {
                key: "handleElementEvent",
                value: function (e) {
                    switch (e.type) {
                    case "playing":
                        this.log_.info("stream - video player is starting playing"), this.state_ = "PLAYING", lg.emit(hg.VIDEO_PLAYING, {
                            stream: this.stream_
                        }), this.emitter_.emit(cg, {
                            state: this.state_,
                            reason: "playing"
                        });
                        break;
                    case "ended":
                        this.log_.info("stream - video player is ended"), "STOPPED" !== this.state_ && (this.state_ = "STOPPED", this.emitter_.emit(cg, {
                            state: this.state_,
                            reason: "ended"
                        }));
                        break;
                    case "pause":
                        this.log_.info("stream - video player is paused"), this.state_ = "PAUSED", this.emitter_.emit(cg, {
                            state: this.state_,
                            reason: "pause"
                        }), this.pausedRetryCount_ > 0 && (this.log_.info("auto resume when video paused"), this.resume(), this.pausedRetryCount_--);
                        break;
                    case "error":
                        if (this.element_ && this.element_.error) {
                            var t = "".concat(xv(), "/").concat(qd().name, "/").concat(qd().version);
                            this.log_.error("stream - video player error observed. code: ".concat(this.element_.error.code, " message: ").concat(this.element_.error.message, " deviceInfo: ").concat(t)), Su("stat-".concat(this.stream_.getType(), "-video-").concat(ws, "-").concat(this.element_.error.code, "-").concat(t), this.element_.error)
                        }
                        break;
                    case "loadeddata":
                        lg.emit(hg.VIDEO_LOADED_DATA, {
                            stream: this.stream_
                        })
                    }
                }
            }, {
                key: "handleTrackEvent",
                value: function (e) {
                    var t = e.type;
                    switch (t) {
                    case "ended":
                        this.log_.info("stream - video player track is ended"), "STOPPED" !== this.state_ && (this.state_ = "STOPPED", this.emitter_.emit(cg, {
                            state: this.state_,
                            reason: "ended"
                        })), lg.emit(hg.VIDEO_TRACK_ENDED, {
                            stream: this.stream_,
                            type: t
                        });
                        break;
                    case "mute":
                        this.log_.info("stream - video track is unable to provide media output"), "PAUSED" !== this.state_ && (this.state_ = "PAUSED", this.emitter_.emit(cg, {
                            state: this.state_,
                            reason: "mute"
                        })), lg.emit(hg.VIDEO_TRACK_MUTED, {
                            stream: this.stream_,
                            type: t
                        });
                        break;
                    case "unmute":
                        this.log_.info("stream - video track is able to provide media output"), "PAUSED" === this.state_ && (this.state_ = "PLAYING", this.emitter_.emit(cg, {
                            state: this.state_,
                            reason: "unmute"
                        }), lg.emit(hg.VIDEO_TRACK_UNMUTED, {
                            stream: this.stream_
                        }))
                    }
                }
            }, {
                key: "unbindEvents",
                value: function () {
                    this.element_ && (this.element_.removeEventListener("playing", this.handleElementEvent), this.element_.removeEventListener("ended", this.handleElementEvent), this.element_.removeEventListener("pause", this.handleElementEvent), this.element_.removeEventListener("error", this.handleElementEvent), this.element_.removeEventListener("loadeddata", this.handleElementEvent)), this.track_ && (this.track_.removeEventListener("ended", this.handleTrackEvent), this.track_.removeEventListener("mute", this.handleTrackEvent), this.track_.removeEventListener("unmute", this.handleTrackEvent))
                }
            }, {
                key: "stop",
                value: function () {
                    this.unbindEvents(), this.div_.removeChild(this.element_), this.element_.srcObject = null, this.element_ = null
                }
            }, {
                key: "resume",
                value: (t = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, e.next = 3, this.element_.play();
                        case 3:
                            e.next = 11;
                            break;
                        case 5:
                            if (e.prev = 5, e.t0 = e.catch(0), this.log_.warn("<video> play() error: " + e.t0), !(t = Z_({
                                key: Tm,
                                data: {
                                    error: e.t0
                                }
                            })).startsWith("NotAllowedError")) {
                                e.next = 11;
                                break
                            }
                            throw new ic({
                                code: rc.PLAY_NOT_ALLOWED,
                                message: t
                            });
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 5]
                    ])
                }))), function () {
                    return t.apply(this, arguments)
                })
            }, {
                key: "getVideoFrame",
                value: function () {
                    var e = document.createElement("canvas");
                    return e.width = this.element_.videoWidth, e.height = this.element_.videoHeight, e.getContext("2d").drawImage(this.element_, 0, 0), e.toDataURL("image/png")
                }
            }, {
                key: "on",
                value: function (e, t) {
                    this.emitter_.on(e, t)
                }
            }]), e
        }(),
        Pg = function () {
            function e(t) {
                a(this, e), this.userId_ = t.userId, this.tinyId_ = t.tinyId, this.client_ = t.client, this.sdpSemantics_ = t.client.getSdpSemantics(), this.isUplink_ = t.isUplink, this.log_ = new dg({
                    id: "n|" + this.userId_,
                    direction: this.isUplink_ ? "local" : "remote",
                    type: ""
                }), this.signalChannel_ = t.signalChannel, this.peerConnection_ = null, this.connectTimer_ = -1, this.isErrorObserved_ = !1, this.emitter_ = new Vp, this.currentState_ = es, this.waitForPeerConnectionConnectedPromise_ = null, this.isReconnecting_ = !1, this.reconnectionCount_ = 0, this.reconnectionTimer_ = -1, this.isFirstConnection_ = !0
            }
            var t;
            return s(e, [{
                key: "initialize",
                value: function () {
                    var e = {
                        iceServers: this.client_.getIceServers(),
                        iceTransportPolicy: this.client_.getIceTransportPolicy(),
                        sdpSemantics: this.sdpSemantics_,
                        bundlePolicy: "max-bundle",
                        rtcpMuxPolicy: "require",
                        tcpCandidatePolicy: "disable",
                        IceTransportsType: "nohost"
                    };
                    this.peerConnection_ = new RTCPeerConnection(e), this.peerConnection_.onconnectionstatechange = this.onConnectionStateChange.bind(this)
                }
            }, {
                key: "close",
                value: function () {
                    this.log_.info("closing connection"), this.closePeerConnection()
                }
            }, {
                key: "closePeerConnection",
                value: function () {
                    var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
                    this.peerConnection_ && (this.peerConnection_.onconnectionstatechange = function () {}, this.peerConnection_.close(), this.peerConnection_ = null, e && this.emitConnectionStateChangedEvent(es))
                }
            }, {
                key: "getDTLSTransportState",
                value: function () {
                    if (!this.peerConnection_) return "unknown";
                    var e = null;
                    if (this.isUplink_) {
                        if (!Ev() || 0 === this.peerConnection_.getSenders().length) return "unknown";
                        e = this.peerConnection_.getSenders()[0].transport
                    } else {
                        if (!Rv() || 0 === this.peerConnection_.getReceivers().length) return "unknown";
                        e = this.peerConnection_.getReceivers()[0].transport
                    }
                    return e ? e.state : "unknown"
                }
            }, {
                key: "onConnectionStateChange",
                value: function (e) {
                    var t = this.peerConnection_.iceConnectionState,
                        n = this.getDTLSTransportState();
                    if (this.log_.info("onConnectionStateChange() connectionState: " + e.target.connectionState), this.log_.info("ICE Transport state: ".concat(t, ", DTLS Transport state: ").concat(n)), "connecting" === e.target.connectionState && this.emitConnectionStateChangedEvent(ts), "failed" === e.target.connectionState || "closed" === e.target.connectionState) {
                        var r = "".concat(this.isUplink_ ? "uplink" : "downlink", " ICE/DTLS Transport connection ").concat(e.target.connectionState, ". ICE Transport state: ").concat(t, ", DTLS Transport state: ").concat(n),
                            i = new ic({
                                message: r,
                                code: rc.ICE_TRANSPORT_ERROR
                            });
                        bu({
                            eventType: ys,
                            error: i
                        }), this.emitConnectionStateChangedEvent(es), this.isErrorObserved_ || this.emitter_.emit(Bv, i)
                    }
                    if (("connected" === e.target.connectionState || "completed" === e.target.connectionState) && (this.logSelectedCandidate(), ku({
                        eventType: ys
                    }), this.emitConnectionStateChangedEvent(rs), !this.isUplink_ && !this.sentSubscriptionAfterConnected_ && this.pendingSubscription_.length > 0)) {
                        this.log_.info("send pending subscription after RTCPeerConnection is connected");
                        var a = this.pendingSubscription_[0];
                        this.doSendSubscription(a.data, a.stream, a.type), this.sentSubscriptionAfterConnected_ = !0
                    }
                }
            }, {
                key: "emitConnectionStateChangedEvent",
                value: function (e) {
                    e !== this.currentState_ && (this.currentState_ === ns && e === ts || (lg.emit(hg.CONNECTION_STATE_CHANGED, {
                        client: this.client_,
                        connection: this,
                        prevState: this.currentState_,
                        state: e
                    }), this.emitter_.emit(Hv, {
                        prevState: this.currentState_,
                        state: e
                    }), this.currentState_ = e))
                }
            }, {
                key: "hitTest",
                value: function (e) {
                    return (0 === e || "0" === e) && this.isUplink_ || e === this.tinyId_
                }
            }, {
                key: "addEventInternal",
                value: function (e, t) {
                    var n = this.client_.getUserId(),
                        r = {
                            eventId: e,
                            eventDesc: t,
                            timestamp: mu(),
                            userId: n,
                            tinyId: this.client_.getTinyId()
                        };
                    this.isUplink_ || (r.remoteUserId = this.userId_, r.remoteTinyId = this.tinyId_), $f(n, r)
                }
            }, {
                key: "getPeerConnection",
                value: function () {
                    return this.peerConnection_
                }
            }, {
                key: "getClient",
                value: function () {
                    return this.client_
                }
            }, {
                key: "getUserId",
                value: function () {
                    return this.userId_
                }
            }, {
                key: "getTinyId",
                value: function () {
                    return this.tinyId_
                }
            }, {
                key: "logSelectedCandidate",
                value: (t = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i, a, o, s;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.peerConnection_) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return");
                        case 2:
                            return e.next = 4, this.peerConnection_.getStats();
                        case 4:
                            t = e.sent, n = k(t), e.prev = 6, n.s();
                        case 8:
                            if ((r = n.n()).done) {
                                e.next = 18;
                                break
                            }
                            if ((i = g(r.value, 2))[0], a = i[1], !Pv(a)) {
                                e.next = 16;
                                break
                            }
                            return o = t.get(a.localCandidateId), s = t.get(a.remoteCandidateId), o && this.log_.debug("local candidate: ".concat(o.candidateType, " ").concat(o.protocol, ":").concat(o.ip || o.address, ":").concat(o.port, " ").concat(o.networkType || "", " ").concat("relay" === o.candidateType ? "relayProtocol:" + o.relayProtocol : "")), s && this.log_.debug("remote candidate: ".concat(s.candidateType, " ").concat(s.protocol, ":").concat(s.ip || s.address, ":").concat(s.port)), e.abrupt("break", 18);
                        case 16:
                            e.next = 8;
                            break;
                        case 18:
                            e.next = 23;
                            break;
                        case 20:
                            e.prev = 20, e.t0 = e.catch(6), n.e(e.t0);
                        case 23:
                            return e.prev = 23, n.f(), e.finish(23);
                        case 26:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [6, 20, 23, 26]
                    ])
                }))), function () {
                    return t.apply(this, arguments)
                })
            }, {
                key: "getCurrentState",
                value: function () {
                    return this.currentState_
                }
            }, {
                key: "waitForPeerConnectionConnected",
                value: function () {
                    var e = this;
                    return this.waitForPeerConnectionConnectedPromise_ || (this.waitForPeerConnectionConnectedPromise_ = new Promise((function (t, n) {
                        if (e.currentState_ === rs) return t();
                        var r = -1,
                            i = function n(i) {
                                i.state === rs && (clearTimeout(r), e.emitter_.off(Hv, n, e), t())
                            };
                        r = setTimeout((function () {
                            e.emitter_.off(Hv, i, e), n(new ic({
                                code: rc.API_CALL_TIMEOUT,
                                message: "connection timeout"
                            }))
                        }), 1e4), e.emitter_.on(Hv, i, e)
                    })), this.waitForPeerConnectionConnectedPromise_ = this.waitForPeerConnectionConnectedPromise_.then((function (t) {
                        return e.waitForPeerConnectionConnectedPromise_ = null, t
                    })).catch((function (t) {
                        throw e.waitForPeerConnectionConnectedPromise_ = null, t
                    }))), this.waitForPeerConnectionConnectedPromise_
                }
            }, {
                key: "getReconnectionCount",
                value: function () {
                    return this.reconnectionCount_
                }
            }, {
                key: "startReconnection",
                value: function () {
                    this.isReconnecting_ = !0, this.emitConnectionStateChangedEvent(ns), this.reconnect(), this.addEventInternal(this.isUplink_ ? zf : Kf, "".concat(this.isUplink_ ? "uplink" : "downlink", "-connection is reconnecting"))
                }
            }, {
                key: "stopReconnection",
                value: function () {
                    this.log_.info("stop reconnection"), this.isReconnecting_ = !1, this.reconnectionCount_ = 0, this.clearReconnectionTimer(), this.signalChannel_.off(Fp, this.reconnect, this)
                }
            }, {
                key: "on",
                value: function (e, t, n) {
                    this.emitter_.on(e, t, n)
                }
            }, {
                key: "off",
                value: function (e, t, n) {
                    this.emitter_.off(e, t, n)
                }
            }]), e
        }(),
        Dg = {
            TRTC: {
                createClient: {
                    name: "clientConfig",
                    required: !0,
                    type: Us,
                    properties: {
                        sdkAppId: {
                            required: !0,
                            type: Ms,
                            allowEmpty: !1
                        },
                        userId: {
                            required: !0,
                            type: Ns,
                            allowEmpty: !1
                        },
                        userSig: {
                            required: !0,
                            type: Ns,
                            allowEmpty: !1
                        },
                        mode: {
                            required: !0,
                            type: Ns,
                            values: ["rtc", "live"]
                        },
                        useStringRoomId: {
                            type: Ls
                        },
                        autoSubscribe: {
                            type: Ls
                        },
                        streamId: {
                            type: Ns
                        },
                        userDefineRecordId: {
                            type: Ns
                        },
                        pureAudioPushMode: {
                            type: Ms,
                            values: [1, 2]
                        }
                    }
                },
                createStream: {
                    name: "streamConfig",
                    required: !0,
                    type: Us,
                    properties: {
                        userId: {
                            type: Ns
                        },
                        audio: {
                            type: Ls
                        },
                        video: {
                            type: Ls
                        },
                        screen: {
                            type: Ls
                        },
                        screenAudio: {
                            type: Ls
                        },
                        microphoneId: {
                            type: Ns
                        },
                        cameraId: {
                            type: Ns
                        },
                        facingMode: {
                            type: Ns,
                            values: [Hs, Gs]
                        },
                        audioSource: {
                            instanceOf: MediaStreamTrack
                        },
                        videoSource: {
                            instanceOf: MediaStreamTrack
                        },
                        mirror: {
                            type: Ls
                        }
                    },
                    validate: function (e) {
                        if (!Du(e.screen) && e.screen && Du(e.audio) && (e.audio = !1), !(Du(e.audio) && Du(e.video) || Du(e.audioSource) && Du(e.videoSource))) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: L_
                            })
                        });
                        if (!Du(e.screen) && !0 === e.screen && !0 === e.video) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: V_
                            })
                        });
                        if (e.audio && e.screenAudio) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: U_
                            })
                        });
                        if (!0 !== e.screen && !0 === e.screenAudio) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: F_
                            })
                        });
                        if (!Du(e.screen) && !0 === e.screen && !this.isScreenShareSupported()) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: q_
                            })
                        })
                    }
                }
            },
            CLIENT: {
                join: {
                    name: "joinOptions",
                    required: !0,
                    properties: {
                        roomId: {
                            required: !0,
                            type: [Ms, Ns],
                            allowEmpty: !1,
                            validate: function (e) {
                                if (this.useStringRoomId_) {
                                    if (!(xu(e) && /^[A-Za-z\d\s!#$%&()+\-:;<=.>?@[\]^_{}|~,]{1,64}$/.test(e))) throw new ic({
                                        code: rc.INVALID_PARAMETER,
                                        message: Z_({
                                            key: Am
                                        })
                                    })
                                } else if (!(Ou(e) && /^[1-9]\d*$/.test(String(e)) && e < 4294967295)) throw new ic({
                                    code: rc.INVALID_PARAMETER,
                                    message: Z_({
                                        key: Pm
                                    })
                                })
                            }
                        },
                        role: {
                            type: [Ns],
                            values: ["anchor", "audience"]
                        }
                    }
                },
                publish: {
                    name: "stream",
                    required: !0,
                    instanceOf: Zs,
                    validate: function (e) {
                        if (!fv.result) throw new ic({
                            code: rc.NOT_SUPPORTED,
                            message: Z_({
                                key: H_
                            })
                        });
                        if (!this.isJoined_) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: Mm
                            })
                        });
                        if ("live" === this.mode_ && "audience" === this.role_) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: Vm
                            })
                        });
                        if (this.localStream_) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: Fm
                            })
                        });
                        if (!e.getIsReadyToPublish()) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: Um
                            })
                        });
                        if (this.notPublishWithoutH264Supported_) throw new ic({
                            code: rc.NOT_SUPPORTED_H264,
                            message: Z_({
                                key: J_
                            })
                        })
                    }
                },
                unpublish: {
                    name: "stream",
                    required: !0,
                    instanceOf: Zs,
                    validate: function (e) {
                        if (e !== this.localStream_) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: Lm
                            })
                        })
                    }
                },
                subscribe: [{
                    name: "stream",
                    required: !0,
                    instanceOf: ec,
                    validate: function (e) {
                        if (!e.getConnection()) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: jm
                            })
                        });
                        if (this.notSubscribeWithoutH264Supported_) throw new ic({
                            code: rc.NOT_SUPPORTED_H264,
                            message: Z_({
                                key: z_
                            })
                        })
                    }
                }, {
                    name: "options",
                    type: Us,
                    properties: {
                        audio: {
                            type: Ls
                        },
                        video: {
                            type: Ls
                        }
                    }
                }],
                unsubscribe: {
                    name: "stream",
                    required: !0,
                    instanceOf: ec,
                    validate: function (e) {
                        if (!e.getConnection()) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: jm
                            })
                        })
                    }
                },
                switchRole: {
                    name: "role",
                    required: !0,
                    values: ["anchor", "audience"],
                    validate: function () {
                        if ("live" !== this.mode_) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: Hm
                            })
                        });
                        if (!this.isJoined_) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: Gm
                            })
                        })
                    }
                }
            },
            LOCAL_STREAM: {
                switchDevice: [{
                    name: "type",
                    required: !0,
                    type: Ns,
                    values: [Fs, js]
                }, {
                    name: "deviceId",
                    required: !0,
                    type: Ns,
                    validate: function () {
                        if (this.screen_ || this.audioSource_ || this.videoSource_) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: s_
                            })
                        });
                        if (this.publishState_ === Ks) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: c_
                            })
                        })
                    }
                }]
            },
            STREAM: {
                play: [{
                    name: "elementId",
                    required: !0,
                    type: [Ns, "HTMLDivElement"]
                }, {
                    name: "options",
                    type: Us,
                    properties: {
                        objectFit: {
                            type: Ns,
                            values: ["contain", "cover"]
                        },
                        muted: {
                            type: Ls
                        }
                    },
                    validate: function () {
                        if (this.isPlaying_) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: M_
                            })
                        })
                    }
                }]
            }
        },
        xg = Xe.PROPER,
        Og = Kr.trim;

    function Ng() {
        for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
        return function (e, n, r) {
            var i = r.value;
            return r.value = function () {
                for (var e = arguments.length, r = new Array(e), a = 0; a < e; a++) r[a] = arguments[a];
                return Lg.call(this, t, r, n, this.name_), i.apply(this, r)
            }, r
        }
    }

    function Mg() {
        for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
        return function (e, n, r) {
            var a = r.value;
            return r.value = i(regeneratorRuntime.mark((function e() {
                var r, i, o, s = arguments;
                return regeneratorRuntime.wrap((function (e) {
                    for (;;) switch (e.prev = e.next) {
                    case 0:
                        for (r = s.length, i = new Array(r), o = 0; o < r; o++) i[o] = s[o];
                        return Lg.call(this, t, i, n, this.name_), e.abrupt("return", a.apply(this, i));
                    case 3:
                    case "end":
                        return e.stop()
                    }
                }), e, this)
            }))), r
        }
    }

    function Lg(e, t, n, r) {
        try {
            for (var i = 0; i < e.length; i++) {
                Vg.call(this, {
                    rule: e[i],
                    value: t[i],
                    fnName: n,
                    className: r
                });
                var a = e[i].properties;
                if (wu(a))
                    for (var o = Object.keys(a), s = 0; s < o.length; s++) {
                        var c = o[s];
                        Vg.call(this, {
                            rule: a[c],
                            value: t[i] && t[i][c],
                            key: c,
                            fnName: n,
                            className: r
                        })
                    }
            }
        } catch (GS) {
            throw Kd.error(GS), GS
        }
    }

    function Vg(e) {
        var t = e.rule,
            n = e.value,
            r = e.key,
            i = e.fnName,
            a = e.className;
        if (Du(n)) {
            if (t.required) throw new ic({
                code: rc.INVALID_PARAMETER,
                message: Z_({
                    key: om,
                    data: {
                        key: r,
                        rule: t,
                        fnName: i,
                        value: n
                    },
                    link: {
                        className: a,
                        fnName: i
                    }
                })
            })
        } else {
            if (Array.isArray(t.type)) {
                if (!t.type.map((function (e) {
                    return e.toLowerCase()
                })).includes(Nu(n))) throw new ic({
                    code: rc.INVALID_PARAMETER,
                    message: Z_({
                        key: sm,
                        data: {
                            key: r,
                            rule: t,
                            fnName: i,
                            value: n
                        },
                        link: {
                            className: a,
                            fnName: i
                        }
                    })
                })
            } else if (!Du(t.type) && Nu(n) !== t.type) throw new ic({
                code: rc.INVALID_PARAMETER,
                message: Z_({
                    key: sm,
                    data: {
                        key: r,
                        rule: t,
                        fnName: i,
                        value: n
                    },
                    link: {
                        className: a,
                        fnName: i
                    }
                })
            });
            if (!1 === t.allowEmpty && (0 === n || xu(n) && "" === n.trim())) throw new ic({
                code: rc.INVALID_PARAMETER,
                message: Z_({
                    key: cm,
                    data: {
                        key: r,
                        rule: t,
                        fnName: i,
                        value: n
                    },
                    link: {
                        className: a,
                        fnName: i
                    }
                })
            });
            if (xu(t.instanceOf)) {
                if (!n || n.name_ !== t.instanceOf) throw new ic({
                    code: rc.INVALID_PARAMETER,
                    message: Z_({
                        key: um,
                        data: {
                            key: r,
                            rule: t,
                            fnName: i,
                            value: n
                        },
                        link: {
                            className: a,
                            fnName: i
                        }
                    })
                })
            } else if (Pu(t.instanceOf) && !(n instanceof t.instanceOf)) throw new ic({
                code: rc.INVALID_PARAMETER,
                message: Z_({
                    key: um,
                    data: {
                        key: r,
                        rule: t,
                        fnName: i,
                        value: n
                    },
                    link: {
                        className: a,
                        fnName: i
                    }
                })
            });
            if (t.values && !t.values.includes(n)) throw new ic({
                code: rc.INVALID_PARAMETER,
                message: Z_({
                    key: dm,
                    data: {
                        key: r,
                        rule: t,
                        fnName: i,
                        value: n
                    },
                    link: {
                        className: a,
                        fnName: i
                    }
                })
            });
            Pu(t.validate) && t.validate.call(this, n, this)
        }
    }
    Et({
        target: "String",
        proto: !0,
        forced: (kg = "trim", P((function () {
            return !!Gr[kg]() || "​᠎" !== "​᠎" [kg]() || xg && Gr[kg].name !== kg
        })))
    }, {
        trim: function () {
            return Og(this)
        }
    });
    var Ug = (bg = Mg.apply(void 0, S(Dg.STREAM.play)), b((Rg = function () {
            function e(t) {
                a(this, e), this.name_ = tc, this.userId_ = t.userId, this.isRemote_ = t.isRemote, this.type_ = t.type, this.log_ = new dg({
                    id: "s".concat(t.seq ? t.seq : "", "|").concat(this.userId_),
                    direction: this.isRemote_ ? "remote" : "local",
                    type: this.isRemote_ ? this.type_ : ""
                }), this.mirror_ = !1, this.isRemote_ || (this.mirror_ = !0), Du(t.mirror) || (this.mirror_ = t.mirror), this.client_ = null, Du(t.client) || (this.client_ = t.client), this.mediaStream_ = null, this.div_ = null, this.isPlaying_ = !1, this.connection_ = null, this.audioPlayer_ = null, this.videoPlayer_ = null, this.muted_ = !1, this.objectFit_ = "cover", this.id_ = yl(), this.audioOutputDeviceId_ = 0, this.audioVolume_ = 1, this.emitter_ = new Vp, this.connectionState_ = es
            }
            var r, o, c, u, d;
            return s(e, [{
                key: "getType",
                value: function () {
                    return this.type_
                }
            }, {
                key: "getIDLogger",
                value: function () {
                    return this.log_
                }
            }, {
                key: "isSubscribed",
                get: function () {
                    return "main" === this.type_ && this.connection_.isMainStreamSubscribed || "auxiliary" === this.type_ && this.connection_.isAuxStreamSubscribed
                }
            }, {
                key: "isMainVideoSubscribed",
                get: function () {
                    var e = this.getSubscribedState();
                    return "main" === this.type_ && e && e.video
                }
            }, {
                key: "isMainAudioSubscribed",
                get: function () {
                    var e = this.getSubscribedState();
                    return "main" === this.type_ && e && e.audio
                }
            }, {
                key: "isAuxVideoSubscribed",
                get: function () {
                    var e = this.getSubscribedState();
                    return "auxiliary" === this.type_ && e && e.auxiliary
                }
            }, {
                key: "emitConnectionStateChanged",
                value: function (e) {
                    e.state !== this.connectionState_ && (e.state !== es && this.isRemote_ && !this.isSubscribed || (this.emitter_.emit(og, e), this.connectionState_ = e.state))
                }
            }, {
                key: "setConnection",
                value: function (e) {
                    this.connection_ !== e && (e instanceof Pg ? (null !== this.connection_ && this.connection_.off(Hv, this.emitConnectionStateChanged, this), e.on(Hv, this.emitConnectionStateChanged, this)) : null === e && this.connection_.off(Hv, this.emitConnectionStateChanged, this), this.connection_ = e)
                }
            }, {
                key: "getConnection",
                value: function () {
                    return this.connection_
                }
            }, {
                key: "play",
                value: (d = i(regeneratorRuntime.mark((function e(t, r) {
                    var i, a;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return this.isPlaying_ = !0, this.log_.info("stream start to play with options: ".concat(JSON.stringify(r))), (i = document.createElement("div")).setAttribute("id", "player_".concat(this.id_)), i.setAttribute("style", "width: 100%; height: 100%; position: relative; background-color: black; overflow: hidden;"), a = t, "object" !== n(t) && (a = document.getElementById(t)), a.appendChild(i), this.div_ = i, this.isRemote_ || (this.muted_ = !0), r && !Du(r.muted) && (this.muted_ = r.muted), this.isRemote_ && "auxiliary" === this.getType() && (this.objectFit_ = "contain"), r && !Du(r.objectFit) && (this.objectFit_ = r.objectFit), lg.emit(hg.PLAY_STREAM_START, {
                                stream: this
                            }), e.next = 16, Promise.all([this.playAudio(), this.playVideo()]);
                        case 16:
                            lg.emit(hg.STREAM_PLAY_SUCCESS, {
                                stream: this
                            });
                        case 17:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e, t) {
                    return d.apply(this, arguments)
                })
            }, {
                key: "playAudio",
                value: (u = i(regeneratorRuntime.mark((function e() {
                    var n, r = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.hasAudio() && (!this.isRemote_ || this.isMainAudioSubscribed)) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return");
                        case 2:
                            if (n = this.getAudioTrack(), this.audioPlayer_ || !n) {
                                e.next = 16;
                                break
                            }
                            return this.log_.info("stream - create AudioPlayer and play"), this.audioPlayer_ = new wg({
                                stream: this,
                                track: n,
                                div: this.div_,
                                muted: this.muted_,
                                outputDeviceId: this.audioOutputDeviceId_,
                                volume: this.audioVolume_
                            }), this.audioPlayer_.on(cg, (function (e) {
                                var n = {
                                    type: Fs,
                                    state: e.state,
                                    reason: e.reason
                                };
                                lg.emit(hg.PLAYER_STATE_CHANGED, t({
                                    stream: r
                                }, n)), r.emitter_.emit(ig, n)
                            })), e.prev = 7, e.next = 10, this.audioPlayer_.play();
                        case 10:
                            e.next = 16;
                            break;
                        case 12:
                            throw e.prev = 12, e.t0 = e.catch(7), this.emitter_.emit(sg, e.t0), e.t0;
                        case 16:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [7, 12]
                    ])
                }))), function () {
                    return u.apply(this, arguments)
                })
            }, {
                key: "playVideo",
                value: (c = i(regeneratorRuntime.mark((function e() {
                    var n, r = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.hasVideo() && (!this.isRemote_ || this.isMainVideoSubscribed || this.isAuxVideoSubscribed)) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return");
                        case 2:
                            if (n = this.getVideoTrack(), this.videoPlayer_ || !n) {
                                e.next = 17;
                                break
                            }
                            return lg.emit(hg.PLAY_VIDEO_START, {
                                stream: this
                            }), this.log_.info("stream - create VideoPlayer and play"), this.videoPlayer_ = new Ag({
                                stream: this,
                                track: n,
                                div: this.div_,
                                muted: this.muted_,
                                objectFit: this.objectFit_,
                                mirror: this.mirror_
                            }), this.videoPlayer_.on(cg, (function (e) {
                                var n = {
                                    type: js,
                                    state: e.state,
                                    reason: e.reason
                                };
                                lg.emit(hg.PLAYER_STATE_CHANGED, t({
                                    stream: r
                                }, n)), r.emitter_.emit(ig, n)
                            })), e.prev = 8, e.next = 11, this.videoPlayer_.play();
                        case 11:
                            e.next = 17;
                            break;
                        case 13:
                            throw e.prev = 13, e.t0 = e.catch(8), this.emitter_.emit(sg, e.t0), e.t0;
                        case 17:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [8, 13]
                    ])
                }))), function () {
                    return c.apply(this, arguments)
                })
            }, {
                key: "stopAudio",
                value: function () {
                    this.audioPlayer_ && (this.log_.info("stream - stop AudioPlayer"), this.audioPlayer_.stop(), this.audioPlayer_ = null)
                }
            }, {
                key: "stopVideo",
                value: function () {
                    this.videoPlayer_ && (this.log_.info("stream - stop VideoPlayer"), this.videoPlayer_.stop(), this.videoPlayer_ = null)
                }
            }, {
                key: "restartAudio",
                value: function () {
                    this.isPlaying_ && (this.stopAudio(), this.playAudio().catch((function (e) {})))
                }
            }, {
                key: "restartVideo",
                value: function () {
                    this.isPlaying_ && (this.stopVideo(), this.playVideo().catch((function (e) {})))
                }
            }, {
                key: "stop",
                value: function () {
                    this.isPlaying_ && (this.isPlaying_ = !1, this.stopAudio(), this.stopVideo(), this.div_.parentNode.removeChild(this.div_))
                }
            }, {
                key: "resume",
                value: (o = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.isPlaying_) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return");
                        case 2:
                            if (this.log_.info("stream - resume"), !this.audioPlayer_) {
                                e.next = 6;
                                break
                            }
                            return e.next = 6, this.audioPlayer_.resume();
                        case 6:
                            if (!this.videoPlayer_) {
                                e.next = 9;
                                break
                            }
                            return e.next = 9, this.videoPlayer_.resume();
                        case 9:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return o.apply(this, arguments)
                })
            }, {
                key: "close",
                value: function () {
                    this.isPlaying_ && this.stop(), this.mediaStream_ && (this.mediaStream_.preventEvent = 1, this.mediaStream_.getTracks().forEach((function (e) {
                        e.stop()
                    })), this.mediaStream_ = null)
                }
            }, {
                key: "muteAudio",
                value: function () {
                    return this.addRemoteEvent(!0, Fs), this.doEnableTrack(Fs, !1)
                }
            }, {
                key: "muteVideo",
                value: function () {
                    return this.addRemoteEvent(!0, js), this.doEnableTrack(js, !1)
                }
            }, {
                key: "unmuteAudio",
                value: function () {
                    return this.addRemoteEvent(!1, Fs), this.doEnableTrack(Fs, !0)
                }
            }, {
                key: "unmuteVideo",
                value: function () {
                    return this.addRemoteEvent(!1, js), this.doEnableTrack(js, !0)
                }
            }, {
                key: "addRemoteEvent",
                value: function (e, t) {
                    if (this.isRemote_ && this.client_) {
                        var n = this.client_.getUserId(),
                            r = "".concat(e ? "mute" : "unmute", " remote ").concat(t);
                        $f(n, {
                            eventId: t === Fs ? e ? Of : Mf : e ? xf : Nf,
                            eventDesc: r,
                            timestamp: (new Date).getTime(),
                            userId: n,
                            tinyId: this.client_.getTinyId(),
                            remoteUserId: this.userId_,
                            remoteTinyId: this.connection_.getTinyId()
                        })
                    }
                }
            }, {
                key: "doEnableTrack",
                value: function (e, t) {
                    var n = !1;
                    return e === Fs ? this.mediaStream_.getAudioTracks().forEach((function (e) {
                        n = !0, e.enabled = t
                    })) : this.mediaStream_.getVideoTracks().forEach((function (e) {
                        n = !0, e.enabled = t
                    })), n
                }
            }, {
                key: "getId",
                value: function () {
                    return this.id_
                }
            }, {
                key: "getUserId",
                value: function () {
                    return this.userId_
                }
            }, {
                key: "getTinyId",
                value: function () {
                    return this.connection_ ? this.connection_.getTinyId() : ""
                }
            }, {
                key: "isPlaying",
                value: function () {
                    return this.isPlaying_
                }
            }, {
                key: "setAudioOutput",
                value: (r = i(regeneratorRuntime.mark((function e(t) {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.audioOutputDeviceId_ = t, !this.audioPlayer_) {
                                e.next = 4;
                                break
                            }
                            return e.next = 4, this.audioPlayer_.setSinkId(t);
                        case 4:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return r.apply(this, arguments)
                })
            }, {
                key: "setAudioVolume",
                value: function (e) {
                    this.audioVolume_ = e, this.log_.info("setAudioVolume to ".concat(e)), this.audioPlayer_ && this.audioPlayer_.setVolume(e)
                }
            }, {
                key: "getAudioLevel",
                value: function () {
                    var e = 0;
                    return this.audioPlayer_ && (e = this.audioPlayer_.getAudioLevel()), e
                }
            }, {
                key: "hasAudio",
                value: function () {
                    if (this.isRemote_) {
                        if (!this.connection_) return !1;
                        var e = this.connection_.getTrackState();
                        return "main" === this.type_ && e.audio
                    }
                    return !!this.getAudioTrack()
                }
            }, {
                key: "hasVideo",
                value: function () {
                    if (this.isRemote_) {
                        if (!this.connection_) return !1;
                        var e = this.connection_.getTrackState();
                        return "auxiliary" === this.type_ ? e.auxiliary : e.video
                    }
                    return !!this.getVideoTrack()
                }
            }, {
                key: "getSubscribedState",
                value: function () {
                    return this.isRemote_ && this.connection_ ? this.connection_.getSubscribeState() : null
                }
            }, {
                key: "getAudioTrack",
                value: function () {
                    var e = null;
                    if (this.mediaStream_) {
                        var t = this.mediaStream_.getAudioTracks();
                        t.length > 0 && (e = t[0])
                    }
                    return e
                }
            }, {
                key: "getVideoTrack",
                value: function () {
                    var e = null;
                    if (this.mediaStream_) {
                        var t = this.mediaStream_.getVideoTracks();
                        t.length > 0 && (e = t[0])
                    }
                    return e
                }
            }, {
                key: "getVideoFrame",
                value: function () {
                    return this.videoPlayer_ ? this.videoPlayer_.getVideoFrame() : null
                }
            }, {
                key: "getMediaStream",
                value: function () {
                    return this.mediaStream_
                }
            }, {
                key: "setMediaStream",
                value: function (e) {
                    e !== this.mediaStream_ && (this.mediaStream_ && this.mediaStream_.getTracks().forEach((function (e) {
                        return e.stop()
                    })), this.mediaStream_ = e)
                }
            }, {
                key: "updateVideoPlayingState",
                value: function (e) {
                    this.isPlaying_ && (e ? (this.log_.info("playing state updated, play video"), this.playVideo().catch((function (e) {}))) : (this.log_.info("playing state updated, stop video"), this.stopVideo()))
                }
            }, {
                key: "updateAudioPlayingState",
                value: function (e) {
                    this.isPlaying_ && (e ? (this.log_.info("playing state updated, play audio"), this.playAudio().catch((function (e) {}))) : (this.log_.info("playing state updated, stop audio"), this.stopAudio()))
                }
            }, {
                key: "on",
                value: function (e, t, n) {
                    this.emitter_.on(e, t, n)
                }
            }, {
                key: "off",
                value: function (e, t, n) {
                    "*" === e ? this.emitter_.removeAllListeners() : this.emitter_.off(e, t, n)
                }
            }, {
                key: "isRemote",
                value: function () {
                    return this.isRemote_
                }
            }, {
                key: "getDiv",
                value: function () {
                    return this.div_
                }
            }, {
                key: "getObjectFit",
                value: function () {
                    return this.objectFit_
                }
            }, {
                key: "getMuted",
                value: function () {
                    return this.muted_
                }
            }, {
                key: "getClient",
                value: function () {
                    return this.client_
                }
            }]), e
        }()).prototype, "play", [bg], Object.getOwnPropertyDescriptor(Rg.prototype, "play"), Rg.prototype), Rg),
        Fg = function (e) {
            u(RemoteStream, e);
            var n = _(RemoteStream);

            function RemoteStream(e) {
                var r;
                a(this, RemoteStream);
                var i = {
                        isRemote: !0,
                        type: e.type
                    },
                    o = t(t({}, e), i);
                return (r = n.call(this, o)).name_ = ec, r.isInSubscriptionCycle_ = !1, r.isStreamAddedEventEmitted_ = !1, r.isAbleToCallSubscription_ = !0, r.installEvents(), r
            }
            return s(RemoteStream, [{
                key: "installEvents",
                value: function () {
                    lg.on(hg.REMOTE_STREAM_SUBSCRIBED, this.handleStreamSubscribed, this), lg.on(hg.REMOTE_STREAM_UNSUBSCRIBED, this.handleStreamUnsubscribed, this)
                }
            }, {
                key: "uninstallEvents",
                value: function () {
                    lg.off(hg.REMOTE_STREAM_SUBSCRIBED, this.handleStreamSubscribed, this), lg.off(hg.REMOTE_STREAM_UNSUBSCRIBED, this.handleStreamUnsubscribed, this)
                }
            }, {
                key: "handleStreamSubscribed",
                value: function (e) {
                    e.client === this.client_ && e.stream === this && this.connection_.getCurrentState() === rs && this.emitConnectionStateChanged({
                        prevState: es,
                        state: rs
                    })
                }
            }, {
                key: "handleStreamUnsubscribed",
                value: function (e) {
                    e.client === this.client_ && e.stream === this && this.emitConnectionStateChanged({
                        prevState: rs,
                        state: es
                    })
                }
            }, {
                key: "getType",
                value: function () {
                    return v(d(RemoteStream.prototype), "getType", this).call(this)
                }
            }, {
                key: "getIsAbleToCallSubscription",
                value: function () {
                    return this.isAbleToCallSubscription_
                }
            }, {
                key: "setIsAbleToCallSubscription",
                value: function (e) {
                    this.isAbleToCallSubscription_ = e
                }
            }, {
                key: "setInSubscriptionCycle",
                value: function (e) {
                    this.isInSubscriptionCycle_ = e
                }
            }, {
                key: "isInSubscriptionCycle",
                value: function () {
                    return this.isInSubscriptionCycle_
                }
            }, {
                key: "setIsStreamAddedEventEmitted",
                value: function (e) {
                    this.isStreamAddedEventEmitted_ = e
                }
            }, {
                key: "getIsStreamAddedEventEmitted",
                value: function () {
                    return this.isStreamAddedEventEmitted_
                }
            }, {
                key: "getAudioTrack",
                value: function () {
                    return this.connection_ && this.connection_.getTrackState().audio ? v(d(RemoteStream.prototype), "getAudioTrack", this).call(this) : null
                }
            }, {
                key: "getVideoTrack",
                value: function () {
                    if (!this.connection_) return null;
                    var e = this.connection_.getTrackState();
                    return ("main" !== this.type_ || e.video) && ("auxiliary" !== this.type_ || e.auxiliary) ? v(d(RemoteStream.prototype), "getVideoTrack", this).call(this) : null
                }
            }, {
                key: "close",
                value: function () {
                    this.uninstallEvents(), v(d(RemoteStream.prototype), "close", this).call(this)
                }
            }]), RemoteStream
        }(Ug),
        jg = function () {
            function e(t) {
                a(this, e), this.client_ = t.client, this.subscribedStreams_ = new Map, this.unsubscribedStreams_ = new Map, this.subscriptedOptions_ = new Map, this.autoRecoveryFlags_ = new Map
            }
            var t, n, r;
            return s(e, [{
                key: "isEnabled",
                get: function () {
                    return "webrtc" !== this.client_.getEnv()
                }
            }, {
                key: "recover",
                value: (r = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (n = t.getUserId(), r = t.getType(), this.hasAutoRecoveryFlag(n, r)) {
                                e.next = 5;
                                break
                            }
                            return e.abrupt("return");
                        case 5:
                            if (i = this.getUnsubscribedStream(n, r) ? "unsubscribe" : "subscribe", e.prev = 6, Kd.warn("recover() try to recover subscription [".concat(i, "][").concat(n, "][").concat(r, "]")), "subscribe" !== i) {
                                e.next = 13;
                                break
                            }
                            return e.next = 11, this.recoverSubscription(n, t);
                        case 11:
                            e.next = 15;
                            break;
                        case 13:
                            return e.next = 15, this.recoverUnsubscription(n, t);
                        case 15:
                            ku({
                                eventType: Es
                            }), Kd.warn("recover() recover successfully [".concat(i, "][").concat(n, "][").concat(r, "]")), e.next = 23;
                            break;
                        case 19:
                            e.prev = 19, e.t0 = e.catch(6), Kd.error("recover() recover failed [".concat(i, "][").concat(n, "][").concat(r, "]"), e.t0), bu({
                                eventType: Es,
                                error: e.t0
                            });
                        case 23:
                            this.deleteAutoRecoveryFlag(n, r);
                        case 24:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [6, 19]
                    ])
                }))), function (e) {
                    return r.apply(this, arguments)
                })
            }, {
                key: "recoverSubscription",
                value: (n = i(regeneratorRuntime.mark((function e(t, n) {
                    var r, i, a, o, s;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (r = this.getOptions(t, n.getType()), i = this.getSubscribedStream(t, n.getType()), r && i) {
                                e.next = 4;
                                break
                            }
                            return e.abrupt("return");
                        case 4:
                            a = this.getStreamMuteState(i), o = a.isAudioMuted, s = a.isVideoMuted, this.mergeStream(i, n), this.recoverPlayingState(i), o && i.doEnableTrack(Fs, !1), s && i.doEnableTrack(js, !1);
                        case 9:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e, t) {
                    return n.apply(this, arguments)
                })
            }, {
                key: "recoverUnsubscription",
                value: (t = i(regeneratorRuntime.mark((function e(t, n) {
                    var r;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (r = this.getUnsubscribedStream(t, n.getType())) {
                                e.next = 3;
                                break
                            }
                            return e.abrupt("return");
                        case 3:
                            this.mergeStream(r, n);
                        case 4:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e, n) {
                    return t.apply(this, arguments)
                })
            }, {
                key: "getStreamMuteState",
                value: function (e) {
                    var t = {
                            isAudioMuted: !1,
                            isVideoMuted: !1
                        },
                        n = e.getMediaStream();
                    return n && (t.isAudioMuted = n.getAudioTracks().map((function (e) {
                        return e.enabled
                    })).includes(!1), t.isVideoMuted = n.getVideoTracks().map((function (e) {
                        return e.enabled
                    })).includes(!1)), t
                }
            }, {
                key: "recoverPlayingState",
                value: function (e) {
                    var t = e.isPlaying(),
                        n = e.getDiv();
                    if (t && n) {
                        var r = n.parentNode;
                        e.stop(), e.play(r, {
                            objectFit: e.getObjectFit(),
                            muted: e.getMuted()
                        })
                    }
                }
            }, {
                key: "mergeStream",
                value: function (e, t) {
                    var n = t.getConnection(),
                        r = t.getMediaStream();
                    e.setConnection(n), n.setRemoteStream(r.id, e), e.setMediaStream(r), e.updateAudioPlayingState(t.hasAudio()), e.updateVideoPlayingState(t.hasVideo())
                }
            }, {
                key: "addSubscriptionRecord",
                value: function (e, t, n) {
                    var r = t.getType();
                    if (this.subscribedStreams_.has(e)) this.subscribedStreams_.get(e).set(r, t);
                    else {
                        var i = new Map;
                        i.set(t.getType(), t), this.subscribedStreams_.set(e, i)
                    } if (this.subscriptedOptions_.has(e)) this.subscriptedOptions_.get(e).set(r, n);
                    else {
                        var a = new Map;
                        a.set(t.getType(), n), this.subscriptedOptions_.set(e, a)
                    }
                    this.deleteUnsubscriptionRecord(e, r)
                }
            }, {
                key: "addUnsubscriptionRecord",
                value: function (e, t) {
                    if (this.unsubscribedStreams_.has(e)) this.unsubscribedStreams_.get(e).set(t.getType(), t);
                    else {
                        var n = new Map;
                        n.set(t.getType(), t), this.unsubscribedStreams_.set(e, n)
                    }
                    this.deleteSubscriptionRecord(e, t.getType())
                }
            }, {
                key: "getSubscribedStream",
                value: function (e, t) {
                    return this.subscribedStreams_.has(e) && this.subscribedStreams_.get(e).has(t) ? this.subscribedStreams_.get(e).get(t) : null
                }
            }, {
                key: "getOptions",
                value: function (e, t) {
                    return this.subscriptedOptions_.has(e) && this.subscriptedOptions_.get(e).has(t) ? this.subscriptedOptions_.get(e).get(t) : null
                }
            }, {
                key: "getUnsubscribedStream",
                value: function (e, t) {
                    return this.unsubscribedStreams_.has(e) && this.unsubscribedStreams_.get(e).has(t) ? this.unsubscribedStreams_.get(e).get(t) : null
                }
            }, {
                key: "deleteSubscriptionRecord",
                value: function (e, t) {
                    this.subscribedStreams_.has(e) && this.subscribedStreams_.get(e).delete(t), this.subscriptedOptions_.has(e) && this.subscriptedOptions_.get(e).delete(t)
                }
            }, {
                key: "deleteUnsubscriptionRecord",
                value: function (e, t) {
                    this.unsubscribedStreams_.has(e) && this.unsubscribedStreams_.get(e).delete(t)
                }
            }, {
                key: "markAllStream",
                value: function () {
                    for (var e = 0, t = S(this.subscribedStreams_.entries()); e < t.length; e++)
                        for (var n = g(t[e], 2), r = n[0], i = 0, a = S(n[1].entries()); i < a.length; i++) {
                            var o = g(a[i], 1)[0];
                            this.setAutoRecoveryFlag(r, o)
                        }
                    for (var s = 0, c = S(this.unsubscribedStreams_.entries()); s < c.length; s++)
                        for (var u = g(c[s], 2), d = u[0], l = 0, h = S(u[1].entries()); l < h.length; l++) {
                            var p = g(h[l], 1)[0];
                            this.setAutoRecoveryFlag(d, p)
                        }
                }
            }, {
                key: "setAutoRecoveryFlag",
                value: function (e, t) {
                    if (Kd.info("setAutoRecoveryFlag() mark [".concat(e, "][").concat(t, "]")), this.autoRecoveryFlags_.has(e)) this.autoRecoveryFlags_.get(e).set(t);
                    else {
                        var n = new Map;
                        n.set(t), this.autoRecoveryFlags_.set(e, n)
                    }
                }
            }, {
                key: "hasAutoRecoveryFlag",
                value: function (e, t) {
                    return !!this.isEnabled && (this.autoRecoveryFlags_.has(e) && this.autoRecoveryFlags_.get(e).has(t))
                }
            }, {
                key: "deleteAutoRecoveryFlag",
                value: function (e, t) {
                    this.autoRecoveryFlags_.has(e) && this.autoRecoveryFlags_.get(e).delete(t)
                }
            }, {
                key: "delete",
                value: function (e) {
                    this.unsubscribedStreams_.delete(e), this.subscribedStreams_.delete(e), this.subscriptedOptions_.delete(e), this.autoRecoveryFlags_.delete(e)
                }
            }]), e
        }();
    Et({
        target: "String",
        proto: !0,
        forced: im("small")
    }, {
        small: function () {
            return rm(this, "small", "", "")
        }
    });
    var Bg = function () {
            function e() {
                a(this, e), this.video_ = document.createElement(js), this.video_.autoplay = !0, this.canvas_ = document.createElement("canvas"), this.canvasCtx_ = this.canvas_.getContext("2d")
            }
            return s(e, [{
                key: "setSrc",
                value: function (e) {
                    this.video_.srcObject = e
                }
            }, {
                key: "setCanvasRect",
                value: function (e, t) {
                    this.canvas_.width = e, this.canvas_.height = t
                }
            }, {
                key: "drawVideoToCanvas",
                value: function () {
                    this.canvasCtx_.drawImage(this.video_, 0, 0, this.canvas_.width, this.canvas_.height)
                }
            }, {
                key: "generateVideoTrackFromCanvasCapture",
                value: function (e) {
                    return this.canvas_.captureStream(e).getVideoTracks()[0]
                }
            }, {
                key: "generateStreamFromTrack",
                value: function (e) {
                    var t = new MediaStream;
                    return t.addTrack(e), t
                }
            }, {
                key: "canvas",
                get: function () {
                    return this.canvas_
                }
            }, {
                key: "canvasCtx",
                get: function () {
                    return this.canvasCtx_
                }
            }, {
                key: "canDrawVideoToCanvas",
                get: function () {
                    return this.video_.readyState === this.video_.HAVE_ENOUGH_DATA
                }
            }]), e
        }(),
        Hg = function () {
            function e() {
                a(this, e), this.processor_ = new Bg
            }
            return s(e, [{
                key: "generateSmallVideoTrack",
                value: function (e) {
                    var t = this.getSmallVideoProfile(e),
                        n = this.processor_.generateStreamFromTrack(e.videoTrack);
                    this.processor_.setSrc(n), this.processor_.setCanvasRect(t.width, t.height);
                    var r = this.processor_.generateVideoTrackFromCanvasCapture(t.framerate);
                    return this.interval_ = Tl.setInterval(this.render.bind(this), Math.ceil(1e3 / t.framerate)), r
                }
            }, {
                key: "render",
                value: function () {
                    this.processor_.canDrawVideoToCanvas && this.processor_.drawVideoToCanvas()
                }
            }, {
                key: "destroy",
                value: function () {
                    Tl.clearInterval(this.interval_)
                }
            }, {
                key: "getSmallVideoProfile",
                value: function (e) {
                    var t, n = e.videoTrack,
                        r = e.smallStreamConfig,
                        i = n.getSettings(),
                        a = i && i.width && i.height ? {
                            width: i.width,
                            height: i.height
                        } : e.videoProfile,
                        o = a.width * a.height,
                        s = r.width * r.height;
                    return Kd.log("big stream resolution: ".concat(a.height, "*").concat(a.width, " small stream resolution: ").concat(r.height, "*").concat(r.width, " ")), o > s ? t = o / s : (Kd.warn("Small stream resolution is larger than big stream, which is invalid. big: ".concat(a.width, " * ").concat(a.height, " small: ").concat(r.width, " * ").concat(r.height)), t = o / 19200), {
                        width: parseInt(a.width / Math.sqrt(t)),
                        height: parseInt(a.height / Math.sqrt(t)),
                        framerate: r.framerate
                    }
                }
            }]), e
        }(),
        Gg = {
            voiceActivityDetection: !1
        },
        Jg = function (e) {
            u(k, e);
            var t, n, r, o, c, l, h, p, f, m, g, S, y, T = _(k);

            function k(e) {
                var t;
                return a(this, k), (t = T.call(this, e)).localStream_ = null, t.exchangeSDPTimeout_ = -1, t.generator_ = null, t.isSDPExchanging_ = !1, t.ssrc_ = {
                    audio: 0,
                    video: 0,
                    small: 0
                }, t.canvasTrack_ = null, t
            }
            return s(k, [{
                key: "initialize",
                value: function () {
                    v(d(k.prototype), "initialize", this).call(this), this.installEvents()
                }
            }, {
                key: "reset",
                value: function () {
                    v(d(k.prototype), "close", this).call(this), this.uninstallEvents(), this.clearExchangeSDPTimeout(), this.canvasTrack_ = null, this.localStream_ && this.localStream_.clearCanvas()
                }
            }, {
                key: "close",
                value: function () {
                    this.reset(), this.emitConnectionStateChangedEvent(es), this.generator_ && (this.generator_.destroy(), this.generator_ = null)
                }
            }, {
                key: "installEvents",
                value: function () {
                    this.emitter_.on(Bv, this.handleError, this), this.emitter_.on(Hv, this.handleConnectionStateChange, this)
                }
            }, {
                key: "uninstallEvents",
                value: function () {
                    this.emitter_.off(Bv, this.handleError, this), this.emitter_.off(Hv, this.handleConnectionStateChange, this)
                }
            }, {
                key: "publish",
                value: (y = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a, o;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return this.localStream_ = t, n = t.getMediaStream(), this.log_.info("is publishing stream: ".concat(t.getId())), r = this.localStream_.getAudioTrack(), i = this.localStream_.getVideoTrack(), r && this.peerConnection_.addTrack(r, n), i && (Ku ? (this.canvasTrack_ = this.localStream_.genCanvasTrack(i), this.peerConnection_.addTrack(this.canvasTrack_, n)) : this.peerConnection_.addTrack(i, n), this.client_.getIsEnableSmallStream() && (a = this.localStream_.getVideoProfile(), this.generator_ = new Hg, o = this.generator_.generateSmallVideoTrack({
                                videoTrack: i,
                                videoProfile: a,
                                smallStreamConfig: this.client_.smallStreamConfig_
                            }), this.peerConnection_.addTrack(o, n))), this.updateMediaSettings(n), e.next = 10, this.connect();
                        case 10:
                            return e.abrupt("return", t);
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return y.apply(this, arguments)
                })
            }, {
                key: "updateMediaSettings",
                value: function (e) {
                    var t = this,
                        n = this.client_.getSystemResult().detail,
                        r = n.isH264EncodeSupported,
                        i = n.isVp8EncodeSupported,
                        a = "";
                    r ? a = "H264" : i && (a = "VP8");
                    var o = {
                        EncVideoCodec: a,
                        EncVideoWidth: 0,
                        EncVideoHeight: 0,
                        EncVideoBr: "0",
                        EncVideoFps: 0,
                        EncAudioCodec: "opus",
                        EncAudioFS: 0,
                        EncAudioCh: 0,
                        EncAudioBr: "0"
                    };
                    "getSettings" in MediaStreamTrack.prototype ? e.getTracks().forEach((function (e) {
                        var n = e.getSettings();
                        if (e.kind === Fs) {
                            var r = 1;
                            n.channelCount && (r = n.channelCount), o.EncAudioCh = r, o.EncAudioBr = "".concat(1e3 * t.localStream_.getAudioBitrate()), o.EncAudioFS = n.sampleRate
                        } else e.kind === js && (t.client_.getIsEnableSmallStream() && (o.EncSmallVideoWidth = t.client_.smallStreamConfig.width, o.EncSmallVideoHeight = t.client_.smallStreamConfig.height, o.EncSmallVideoFps = t.client_.smallStreamConfig.framerate, o.EncSmallVideoBr = "".concat(1e3 * t.client_.smallStreamConfig.bitrate)), o.EncVideoWidth = n.width, o.EncVideoHeight = n.height, o.EncVideoFps = n.frameRate, o.EncVideoBr = "".concat(1e3 * t.localStream_.getVideoBitrate()))
                    })) : o = this.getMediaSettingsFromProfile(o), this.log_.info("updateMediaSettings: " + JSON.stringify(o)), this.signalChannel_.send(ef, o)
                }
            }, {
                key: "getMediaSettingsFromProfile",
                value: function (e) {
                    var t = this.localStream_;
                    if (t) {
                        if (t.getAudioTrack()) {
                            var n = t.getAudioProfile();
                            e.EncAudioCh = n.channelCount, e.EncAudioBr = "".concat(1e3 * n.bitrate), e.EncAudioFS = n.sampleRate
                        }
                        if (t.getVideoTrack()) {
                            var r = t.getVideoProfile();
                            e.EncVideoWidth = r.width, e.EncVideoHeight = r.height, e.EncVideoFps = r.frameRate, e.EncVideoBr = "".concat(1e3 * r.bitrate)
                        }
                    }
                    return e
                }
            }, {
                key: "addTrack",
                value: (S = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!this.peerConnection_) {
                                e.next = 20;
                                break
                            }
                            if (t.kind === js && Ku && (t = this.canvasTrack_ = this.localStream_.genCanvasTrack(t)), this.log_.info("is adding ".concat(t.kind, " track to current published local stream")), !(this.peerConnection_.getTransceivers().findIndex((function (e) {
                                return "stopped" === e.direction
                            })) >= 0)) {
                                e.next = 7;
                                break
                            }
                            return this.log_.warn("transceiver is stopping, negotiate sdp first"), e.next = 7, this.updateOffer(zs, t);
                        case 7:
                            if (!(n = this.peerConnection_.getSenders().find((function (e) {
                                return e.track && e.track.kind === t.kind
                            })))) {
                                e.next = 14;
                                break
                            }
                            return this.log_.warn("sender already exists, remove sender first"), r = n.track, this.removeSender(n), e.next = 14, this.updateOffer(zs, r);
                        case 14:
                            return i = this.localStream_.getMediaStream(), this.peerConnection_.addTrack(t, i), this.updateMediaSettings(i), e.next = 19, this.updateOffer(Js, t);
                        case 19:
                            $f(this.userId_, {
                                eventId: t.kind === Fs ? gf : vf,
                                eventDesc: "add ".concat(t.kind, " track to current published stream"),
                                timestamp: mu(),
                                userId: this.userId_,
                                tinyId: this.tinyId_
                            });
                        case 20:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return S.apply(this, arguments)
                })
            }, {
                key: "isNeedToResetOfferOrder",
                value: function () {
                    if ("plan-b" === this.sdpSemantics_ || !this.peerConnection_ || !this.peerConnection_.localDescription) return !1;
                    for (var e = this.peerConnection_.localDescription.sdp, t = lv(e), n = 0; n < t.media.length; n++)
                        if (0 === t.media[n].mid && t.media[n].type === js) return !0;
                    return !1
                }
            }, {
                key: "removeSender",
                value: function (e) {
                    var t = null;
                    "RTCPeerConnection" in window && "getTransceivers" in window.RTCPeerConnection.prototype && (t = this.peerConnection_.getTransceivers().find((function (t) {
                        return t.sender && t.sender.track === e.track
                    }))), this.peerConnection_.removeTrack(e), t && Pu(t.stop) && (this.log_.info("stop transceiver"), t.stop())
                }
            }, {
                key: "removeTrack",
                value: (g = i(regeneratorRuntime.mark((function e(t) {
                    var n;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!this.peerConnection_ || !Ev()) {
                                e.next = 14;
                                break
                            }
                            if (t.kind === js && Ku && this.canvasTrack_ && (t = this.canvasTrack_, this.localStream_.clearCanvas()), this.log_.info("is removing ".concat(t.kind, " track from current published local stream")), t.kind !== js || !this.isNeedToResetOfferOrder()) {
                                e.next = 9;
                                break
                            }
                            return this.reset(), this.initialize(), e.next = 8, this.publish(this.localStream_);
                        case 8:
                            return e.abrupt("return");
                        case 9:
                            return (n = this.peerConnection_.getSenders().find((function (e) {
                                return e.track === t
                            }))) && (this.removeSender(n), this.updateMediaSettings(this.localStream_.getMediaStream())), e.next = 13, this.updateOffer(zs, t);
                        case 13:
                            $f(this.userId_, {
                                eventId: t.kind === Fs ? yf : Sf,
                                eventDesc: "remove ".concat(t.kind, " track from current published stream"),
                                timestamp: mu(),
                                userId: this.userId_,
                                tinyId: this.tinyId_
                            });
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return g.apply(this, arguments)
                })
            }, {
                key: "isReplaceTrackAvailable",
                value: function () {
                    return "RTCRtpSender" in window && "replaceTrack" in window.RTCRtpSender.prototype
                }
            }, {
                key: "replaceTrack",
                value: (m = i(regeneratorRuntime.mark((function e(t) {
                    var n, r = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (t.kind !== js || !Ku || !this.canvasTrack_) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return");
                        case 2:
                            if (this.isReplaceTrackAvailable() && Ev()) {
                                e.next = 4;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: W_
                                })
                            });
                        case 4:
                            if (this.peerConnection_) {
                                e.next = 6;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: u_
                                })
                            });
                        case 6:
                            if (0 !== (n = this.peerConnection_.getSenders()).length) {
                                e.next = 9;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: u_
                                })
                            });
                        case 9:
                            n.forEach((function (e) {
                                e.track && e.track.kind === t.kind && (r.log_.info("is replacing ".concat(t.kind, " track to current published local stream")), e.replaceTrack(t))
                            })), $f(this.userId_, {
                                eventId: t.kind === Fs ? Df : Pf,
                                eventDesc: "replace ".concat(t.kind, " track from current published stream"),
                                timestamp: mu(),
                                userId: this.userId_,
                                tinyId: this.tinyId_
                            });
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return m.apply(this, arguments)
                })
            }, {
                key: "setBandwidth",
                value: (f = i(regeneratorRuntime.mark((function e(t, n, r) {
                    var i, a;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.isUplink_) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return", r);
                        case 2:
                            if (Cv()) {
                                e.next = 4;
                                break
                            }
                            return e.abrupt("return", n === js ? this.updateVideoBandwidthRestriction(r, t) : this.updateAudioBandwidthRestriction(r, t));
                        case 4:
                            if (!(i = this.peerConnection_.getSenders().find((function (e) {
                                return e.track && e.track.kind === n
                            })))) {
                                e.next = 20;
                                break
                            }
                            return (a = i.getParameters()).encodings && 0 !== a.encodings.length || (a.encodings = [{}]), "unlimited" === t ? delete a.encodings[0].maxBitrate : a.encodings[0].maxBitrate = 1e3 * t, e.prev = 9, e.next = 12, i.setParameters(a);
                        case 12:
                            return this.log_.debug(n + " bandwidth was set to " + t + " kbps"), e.abrupt("return", r);
                        case 16:
                            return e.prev = 16, e.t0 = e.catch(9), this.log_.info("failed to set bandwidth by setting maxBitrate: " + e.t0), e.abrupt("return", n === js ? this.updateVideoBandwidthRestriction(r, t) : this.updateAudioBandwidthRestriction(r, t));
                        case 20:
                            return e.abrupt("return", r);
                        case 21:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [9, 16]
                    ])
                }))), function (e, t, n) {
                    return f.apply(this, arguments)
                })
            }, {
                key: "setSmallStreamBandwidth",
                value: (p = i(regeneratorRuntime.mark((function e(t, n) {
                    var r, i;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.isUplink_) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return", n);
                        case 2:
                            if (Cv()) {
                                e.next = 4;
                                break
                            }
                            return e.abrupt("return", this.updateSmallVideoBandwidthRestriction(n, t));
                        case 4:
                            if (!(r = this.peerConnection_.getSenders().filter((function (e) {
                                return e.track && e.track.kind === js
                            }))[1])) {
                                e.next = 20;
                                break
                            }
                            return (i = r.getParameters()).encodings && 0 !== i.encodings.length || (i.encodings = [{}]), "unlimited" === t ? delete i.encodings[0].maxBitrate : i.encodings[0].maxBitrate = 1e3 * t, e.prev = 9, e.next = 12, r.setParameters(i);
                        case 12:
                            return this.log_.info("small stream bandwidth was set to " + t + " kbps"), e.abrupt("return", n);
                        case 16:
                            return e.prev = 16, e.t0 = e.catch(9), this.log_.debug("failed to set small stream bandwidth by setting maxBitrate: " + e.t0), e.abrupt("return", this.updateSmallVideoBandwidthRestriction(n, t));
                        case 20:
                            return e.abrupt("return", n);
                        case 21:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [9, 16]
                    ])
                }))), function (e, t) {
                    return p.apply(this, arguments)
                })
            }, {
                key: "updateVideoBandwidthRestriction",
                value: function (e, t) {
                    var n = "AS";
                    return Yu && (n = "TIAS", t *= 1e3), e = -1 === e.indexOf("b=" + n + ":") ? e.replace(/m=video (.*)\r\nc=IN (.*)\r\n/, "m=video $1\r\nc=IN $2\r\nb=" + n + ":" + t + "\r\n") : e.replace(new RegExp("b=" + n + ":.*\r\n"), "b=" + n + ":" + t + "\r\n")
                }
            }, {
                key: "updateAudioBandwidthRestriction",
                value: function (e, t) {
                    var n = "AS";
                    return Yu && (n = "TIAS", t *= 1e3), e = e.replace(/m=audio (.*)\r\nc=IN (.*)\r\n/, "m=audio $1\r\nc=IN $2\r\nb=" + n + ":" + t + "\r\n")
                }
            }, {
                key: "updateSmallVideoBandwidthRestriction",
                value: function (e, t) {
                    var n = "AS";
                    Yu && (n = "TIAS", t *= 1e3);
                    var r = /m=video (.*)\r\nc=IN (.*)\r\n/g,
                        i = [],
                        a = r.exec(e);
                    for (i.push(a); null !== a;) a = r.exec(e), i.push(a);
                    var o = i[i.length - 2],
                        s = e.slice(0, o.index),
                        c = e.slice(o.index);
                    return e = -1 === e.indexOf("b=" + n + ":") ? s + (c = c.replace(/m=video (.*)\r\nc=IN (.*)\r\n/, "m=video $1\r\nc=IN $2\r\nb=" + n + ":" + t + "\r\n")) : s + (c = c.replace(new RegExp("b=" + n + ":.*\r\n"), "b=" + n + ":" + t + "\r\n"))
                }
            }, {
                key: "removeBandwidthRestriction",
                value: function (e) {
                    return e.replace(/b=AS:.*\r\n/, "").replace(/b=TIAS:.*\r\n/, "")
                }
            }, {
                key: "removeVideoOrientation",
                value: function (e) {
                    return e.replace(/urn:3gpp:video-orientation/, "")
                }
            }, {
                key: "connect",
                value: (h = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, e.next = 3, this.exchangeSDP();
                        case 3:
                            return e.next = 5, this.waitForPeerConnectionConnected();
                        case 5:
                            e.next = 11;
                            break;
                        case 7:
                            throw e.prev = 7, e.t0 = e.catch(0), this.closePeerConnection(!0), e.t0;
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 7]
                    ])
                }))), function () {
                    return h.apply(this, arguments)
                })
            }, {
                key: "exchangeSDP",
                value: (l = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, this.isSDPExchanging_ = !0, e.next = 4, this.createOffer();
                        case 4:
                            return this.log_.info("createOffer success, sending offer to remote server"), e.next = 7, this.doExchangeSDP();
                        case 7:
                            this.isSDPExchanging_ = !1, e.next = 14;
                            break;
                        case 10:
                            throw e.prev = 10, e.t0 = e.catch(0), this.isSDPExchanging_ = !1, e.t0;
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 10]
                    ])
                }))), function () {
                    return l.apply(this, arguments)
                })
            }, {
                key: "createOffer",
                value: (c = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, e.next = 3, this.peerConnection_.createOffer(Gg);
                        case 3:
                            return t = e.sent, e.next = 6, this.peerConnection_.setLocalDescription(t);
                        case 6:
                            this.updateSSRC(t.sdp), ku({
                                eventType: gs,
                                kind: "offer"
                            }), e.next = 14;
                            break;
                        case 10:
                            throw e.prev = 10, e.t0 = e.catch(0), bu({
                                eventType: gs,
                                kind: "offer",
                                error: e.t0
                            }), e.t0;
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 10]
                    ])
                }))), function () {
                    return c.apply(this, arguments)
                })
            }, {
                key: "doExchangeSDP",
                value: function () {
                    var e = this;
                    return new Promise((function (t, n) {
                        e.exchangeSDPTimeout_ = setTimeout((function () {
                            e.signalChannel_.off(qp.PUBLISH_RESULT, r), e.signalChannel_.off(qp.ON_PUBLISH_RESPONSE, r), e.clearExchangeSDPTimeout();
                            var t = new ic({
                                code: rc.API_CALL_TIMEOUT,
                                message: Z_({
                                    key: _m
                                })
                            });
                            n(t)
                        }), 5e3);
                        var r = function () {
                                var r = i(regeneratorRuntime.mark((function r(i) {
                                    return regeneratorRuntime.wrap((function (r) {
                                        for (;;) switch (r.prev = r.next) {
                                        case 0:
                                            return r.prev = 0, e.clearExchangeSDPTimeout(), r.next = 4, e.acceptAnswer(i.data.content);
                                        case 4:
                                            t(), r.next = 10;
                                            break;
                                        case 7:
                                            r.prev = 7, r.t0 = r.catch(0), n(r.t0);
                                        case 10:
                                        case "end":
                                            return r.stop()
                                        }
                                    }), r, null, [
                                        [0, 7]
                                    ])
                                })));
                                return function (e) {
                                    return r.apply(this, arguments)
                                }
                            }(),
                            a = {
                                type: e.peerConnection_.localDescription.type,
                                sdp: e.removeVideoOrientation(e.peerConnection_.localDescription.sdp),
                                screen: e.localStream_.hasScreenTrack()
                            };
                        e.signalChannel_.once(qp.PUBLISH_RESULT, r), e.signalChannel_.once(qp.ON_PUBLISH_RESPONSE, r), e.log_.debug("sending sdp offer: " + a.sdp), e.signalChannel_.send(nf, a, 0)
                    }))
                }
            }, {
                key: "setSDPDirection",
                value: function (e, t) {
                    var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "all",
                        r = lv(e);
                    return r.media.forEach((function (e) {
                        "all" !== n && e.type !== n || (e.direction = t)
                    })), hv(r)
                }
            }, {
                key: "updateOffer",
                value: (o = i(regeneratorRuntime.mark((function e(t, n) {
                    var r, i, a;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, e.next = 3, this.peerConnection_.createOffer(Gg);
                        case 3:
                            return r = e.sent, Yu && (r.sdp = this.setSDPDirection(r.sdp, "sendrecv")), e.next = 7, this.peerConnection_.setLocalDescription(r);
                        case 7:
                            return i = {
                                action: t,
                                trackId: n.id,
                                kind: n.kind,
                                type: "offer",
                                sdp: this.peerConnection_.localDescription.sdp
                            }, this.log_.info("createOffer success, sending updated offer to remote server"), this.log_.debug("updatedOffer: " + i.sdp), e.next = 12, this.signalChannel_.sendWaitForResponse({
                                command: Kp,
                                data: i,
                                responseCommand: qp.UPDATE_OFFER_RESULT,
                                timeout: 1e4,
                                commandDesc: "update offer"
                            });
                        case 12:
                            return a = e.sent, e.next = 15, this.acceptAnswer(a.data.content);
                        case 15:
                            this.updateSSRC(r.sdp), ku({
                                eventType: gs,
                                kind: "offer"
                            }), e.next = 24;
                            break;
                        case 19:
                            throw e.prev = 19, e.t0 = e.catch(0), this.log_.error(e.t0), bu({
                                eventType: gs,
                                kind: "offer",
                                error: e.t0
                            }), e.t0;
                        case 24:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 19]
                    ])
                }))), function (e, t) {
                    return o.apply(this, arguments)
                })
            }, {
                key: "acceptAnswer",
                value: (r = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a, o;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (77392 !== t.result) {
                                e.next = 3;
                                break
                            }
                            throw this.log_.error(X_.NOT_SUPPORTED_H264ENCODE), new ic({
                                code: rc.NOT_SUPPORTED_H264,
                                message: Z_({
                                    key: J_
                                })
                            });
                        case 3:
                            return n = this.localStream_.getVideoBitrate(), r = this.localStream_.getAudioBitrate(), i = this.removeVideoOrientation(t.sdp), e.prev = 6, e.next = 9, this.setBandwidth(n, js, i);
                        case 9:
                            return i = e.sent, e.next = 12, this.setBandwidth(r, Fs, i);
                        case 12:
                            if (i = e.sent, !this.client_.getIsEnableSmallStream()) {
                                e.next = 18;
                                break
                            }
                            return a = this.client_.smallStreamConfig, e.next = 17, this.setSmallStreamBandwidth(a.bitrate, i);
                        case 17:
                            i = e.sent;
                        case 18:
                            return o = {
                                type: t.type,
                                sdp: i
                            }, e.next = 21, this.peerConnection_.setRemoteDescription(o);
                        case 21:
                            this.log_.debug("accepted answer: " + i), ku({
                                eventType: Ss,
                                kind: "answer"
                            }), e.next = 30;
                            break;
                        case 25:
                            throw e.prev = 25, e.t0 = e.catch(6), bu({
                                eventType: Ss,
                                kind: "answer",
                                error: e.t0
                            }), this.log_.error("failed to accept remote answer " + e.t0), e.t0;
                        case 30:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [6, 25]
                    ])
                }))), function (e) {
                    return r.apply(this, arguments)
                })
            }, {
                key: "sendMutedFlag",
                value: function (e) {
                    var t = {
                        srctinyid: 0,
                        userid: this.userId_,
                        flag: e
                    };
                    this.log_.info("send muted flag: ".concat(e)), this.signalChannel_.send(Zp, t)
                }
            }, {
                key: "getIsReconnecting",
                value: function () {
                    return this.isReconnecting_
                }
            }, {
                key: "reconnect",
                value: (n = i(regeneratorRuntime.mark((function e() {
                    var t, n, r = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (-1 === this.reconnectionTimer_) {
                                e.next = 3;
                                break
                            }
                            return this.log_.warn("reconnect() uplink is reconnecting, ignore current reconnection"), e.abrupt("return");
                        case 3:
                            if (!(this.reconnectionCount_ >= 30)) {
                                e.next = 12;
                                break
                            }
                            return this.log_.warn("SDK has tried reconnect uplink for ".concat(30, " times, but all failed, please check your network")), this.stopReconnection(), t = new ic({
                                code: rc.UPLINK_RECONNECTION_FAILED,
                                message: Z_({
                                    key: Sm
                                })
                            }), bu({
                                eventType: ms,
                                error: t
                            }), this.addEventInternal(qf, "uplink-connection reconnect fail"), this.emitConnectionStateChangedEvent(es), this.emitter_.emit(Bv, t), e.abrupt("return");
                        case 12:
                            if (this.signalChannel_.getCurrentState() === Jp) {
                                e.next = 16;
                                break
                            }
                            return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"), this.signalChannel_.once(Fp, this.reconnect, this), e.abrupt("return");
                        case 16:
                            if (this.reconnectionCount_++, e.prev = 17, this.log_.warn("reconnect() try to reconnect uplink [".concat(this.reconnectionCount_, "/").concat(30, "]")), n = Au(this.reconnectionCount_), this.reconnectionTimer_ = setTimeout((function () {
                                r.log_.warn("reconnect() uplink reconnect timeout(".concat(n / 1e3, "s), try again")), r.signalChannel_.off(qp.UNPUBLISH_RESULT, r.onUnpublishResult, r), r.clearReconnectionTimer(), r.reconnect()
                            }), n), !(this.isSDPExchanging_ || this.peerConnection_ && "connecting" === this.peerConnection_.connectionState)) {
                                e.next = 23;
                                break
                            }
                            return e.abrupt("return");
                        case 23:
                            this.signalChannel_.send(rf), this.signalChannel_.once(qp.UNPUBLISH_RESULT, this.onUnpublishResult, this), e.next = 29;
                            break;
                        case 27:
                            e.prev = 27, e.t0 = e.catch(17);
                        case 29:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [17, 27]
                    ])
                }))), function () {
                    return n.apply(this, arguments)
                })
            }, {
                key: "onUnpublishResult",
                value: (t = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, this.reset(), this.initialize(), e.next = 5, this.publish(this.localStream_);
                        case 5:
                            e.next = 9;
                            break;
                        case 7:
                            e.prev = 7, e.t0 = e.catch(0);
                        case 9:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 7]
                    ])
                }))), function () {
                    return t.apply(this, arguments)
                })
            }, {
                key: "clearExchangeSDPTimeout",
                value: function () {
                    -1 !== this.exchangeSDPTimeout_ && (clearTimeout(this.exchangeSDPTimeout_), this.exchangeSDPTimeout_ = -1)
                }
            }, {
                key: "clearReconnectionTimer",
                value: function () {
                    -1 !== this.reconnectionTimer_ && (clearTimeout(this.reconnectionTimer_), this.reconnectionTimer_ = -1)
                }
            }, {
                key: "handleError",
                value: function (e) {
                    e.getCode() === rc.ICE_TRANSPORT_ERROR && (this.isFirstConnection_ && (this.isFirstConnection_ = !1, bu({
                        eventType: fs,
                        error: e
                    })), this.isReconnecting_ || this.startReconnection())
                }
            }, {
                key: "handleConnectionStateChange",
                value: function (e) {
                    e.state === rs && (this.isFirstConnection_ && (this.isFirstConnection_ = !1, ku({
                        eventType: fs
                    }), this.addEventInternal(jf, "uplink-connection is connected")), this.isReconnecting_ && (ku({
                        eventType: ms
                    }), this.log_.warn("reconnect() uplink reconnect successfully"), this.addEventInternal(Wf, "uplink-connection reconnect success"), this.stopReconnection()))
                }
            }, {
                key: "updateSSRC",
                value: function (e) {
                    var t = this;
                    try {
                        var n = 0;
                        lv(e).media.forEach((function (e) {
                            if (e.type === Fs) {
                                var r = e.ssrcs[0];
                                r && (t.ssrc_.audio = r.id)
                            } else {
                                var i = e.ssrcs[0];
                                switch (n += 1) {
                                case 1:
                                    i && (t.ssrc_.video = i.id);
                                    break;
                                case 2:
                                    i && (t.ssrc_.small = i.id)
                                }
                            }
                        }))
                    } catch (GS) {}
                }
            }, {
                key: "getLocalStreamVideoTrackId",
                value: function () {
                    if (this.peerConnection_) {
                        var e = this.peerConnection_.getSenders().filter((function (e) {
                            return e.track && e.track.kind === js
                        }));
                        if (e[0]) return e[0].track.id
                    }
                    if (this.localStream_) {
                        var t = this.localStream_.getVideoTrack();
                        if (t) return t.id
                    }
                    return ""
                }
            }, {
                key: "getSSRC",
                value: function () {
                    return this.ssrc_
                }
            }]), k
        }(Pg),
        zg = function (e) {
            u(f, e);
            var t, n, r, o, c, l, h, p = _(f);

            function f(e) {
                var t;
                return a(this, f), (t = p.call(this, e)).remoteStreams_ = new Map, t.autoSubscribe = e.autoSubscribe, t.trackState_ = {
                    audio: e.trackState.audio,
                    video: e.trackState.video,
                    auxiliary: e.trackState.auxiliary
                }, t.ssrc_ = {
                    audio: 0,
                    video: 0,
                    auxiliary: 0
                }, t.subscribeState_ = {
                    audio: e.autoSubscribe,
                    video: e.autoSubscribe,
                    auxiliary: e.autoSubscribe
                }, t.pendingSubscription_ = [], t.pendingStreams_ = [], t.subscriptionTimeout_ = -1, t.subscriptionRetryCount_ = 0, t.isSubscriptionPending_ = !1, t.sentSubscriptionAfterConnected_ = !1, t.isSDPExchanging_ = !1, t.installEvents(), t
            }
            return s(f, [{
                key: "isMainStreamSubscribed",
                get: function () {
                    return (this.subscribeState_.audio || this.subscribeState_.video) && (this.trackState_.audio || this.trackState_.video)
                }
            }, {
                key: "isAuxStreamSubscribed",
                get: function () {
                    return this.subscribeState_.auxiliary && this.trackState_.auxiliary
                }
            }, {
                key: "initialize",
                value: function () {
                    v(d(f.prototype), "initialize", this).call(this), this.peerConnection_.ontrack = this.onTrack.bind(this)
                }
            }, {
                key: "close",
                value: function () {
                    var e = this;
                    v(d(f.prototype), "close", this).call(this), this.emitConnectionStateChangedEvent(es), -1 !== this.subscriptionTimeout_ && (clearTimeout(this.subscriptionTimeout_), this.subscriptionTimeout_ = -1), this.remoteStreams_.forEach((function (t) {
                        var n = t;
                        n.setConnection(null), n.getIsStreamAddedEventEmitted() && e.emitter_.emit(Uv, {
                            stream: n
                        })
                    })), this.remoteStreams_.clear(), this.uninstallEvents()
                }
            }, {
                key: "installEvents",
                value: function () {
                    var e = this;
                    lg.on(hg.REMOTE_STREAM_TRACK_UPDATED, this.onRemoteStreamUpdate, this), this.signalChannel_.on(qp.SUBSCRIBE_CHANGE_RESULT, this.onSubscribeChangeResult, this), this.signalChannel_.on(qp.UNSUBSCRIBE_RESULT, this.onUnsubscribeResult, this), this.emitter_.on(Bv, (function (t) {
                        t.getCode() === rc.ICE_TRANSPORT_ERROR && (e.isFirstConnection_ && (e.isFirstConnection_ = !1, bu({
                            eventType: _s,
                            error: t
                        })), e.isReconnecting_ || e.startReconnection())
                    })), this.emitter_.on(Hv, (function (t) {
                        t.state === rs && e.isFirstConnection_ && (e.isFirstConnection_ = !1, ku({
                            eventType: _s
                        }), e.addEventInternal(Bf, "downlink-connection is connected"))
                    }))
                }
            }, {
                key: "uninstallEvents",
                value: function () {
                    lg.removeListener(hg.REMOTE_STREAM_TRACK_UPDATED, this.onRemoteStreamUpdate, this), this.signalChannel_.removeListener(qp.SUBSCRIBE_CHANGE_RESULT, this.onSubscribeChangeResult, this), this.signalChannel_.removeListener(qp.UNSUBSCRIBE_RESULT, this.onUnsubscribeResult, this)
                }
            }, {
                key: "onRemoteStreamUpdate",
                value: function (e) {
                    if (this.hitTest(e.tinyId) && e.client === this.client_) {
                        this.updateTrackState(e.action, e.kind);
                        var t = e.kind === Bs ? $o : Yo,
                            n = this.remoteStreams_.get(t);
                        if (!n) return;
                        e.action === Js ? this.handleRemoteAddTrack(e.kind, n) : this.handleRemoteRemoveTrack(e.kind, n)
                    }
                }
            }, {
                key: "handleRemoteAddTrack",
                value: function (e, t) {
                    this.log_.info("remote add ".concat(e, " track")), e === Fs ? t.updateAudioPlayingState(this.subscribeState_.audio) : t.updateVideoPlayingState(e === Bs ? this.subscribeState_.auxiliary : this.subscribeState_.video), t.getIsStreamAddedEventEmitted() ? this.emitter_.emit(Fv, {
                        stream: t
                    }) : (this.emitter_.emit(Vv, {
                        stream: t
                    }), this.currentState_ === rs && t.emitConnectionStateChanged({
                        prevState: es,
                        state: rs
                    }))
                }
            }, {
                key: "handleRemoteRemoveTrack",
                value: function (e, t) {
                    t.getIsStreamAddedEventEmitted() && (this.log_.info("remote remove ".concat(e, " track")), e !== Bs && (this.trackState_.audio || this.trackState_.video) || t.isInSubscriptionCycle() ? (e === Fs ? t.updateAudioPlayingState(!1) : t.updateVideoPlayingState(!1), this.emitter_.emit(Fv, {
                        stream: t
                    })) : (this.log_.info("remote stream ".concat(t.getType(), " removed")), this.currentState_ === rs && t.emitConnectionStateChanged({
                        prevState: rs,
                        state: es
                    }), this.emitter_.emit(Uv, {
                        stream: t
                    })))
                }
            }, {
                key: "updateTrackState",
                value: function (e, t) {
                    var n = e === Js;
                    switch (t) {
                    case Fs:
                        this.trackState_.audio = n;
                        break;
                    case js:
                        this.trackState_.video = n;
                        break;
                    case Bs:
                        this.trackState_.auxiliary = n
                    }
                    this.log_.info("trackState updated: ".concat(JSON.stringify(this.trackState_)))
                }
            }, {
                key: "onTrack",
                value: function (e) {
                    var t = e.streams[0],
                        n = e.track;
                    if (this.log_.info("ontrack() kind: ".concat(n.kind, " id: ").concat(n.id, " streamId: ").concat(t.id)), "unified-plan" === this.sdpSemantics_) {
                        var r = function (e) {
                            var t = dv.parse(e),
                                n = {
                                    audio: [],
                                    video: []
                                };
                            return t.media.forEach((function (e) {
                                if (e.ssrcs) {
                                    var t = e.ssrcs[0].id >> 16 & 255;
                                    if (e.type === Fs) n.audio.push(Yo);
                                    else if (e.type == js) {
                                        var r = t === Zo ? Yo : $o;
                                        n.video.push(r)
                                    }
                                }
                            })), n
                        }(this.peerConnection_.remoteDescription.sdp);
                        if (n.kind === Fs) {
                            if (0 === r.audio.length || t.id !== Yo) return void this.log_.debug("skip this invalid audio track")
                        } else if (-1 === r.video.indexOf(t.id)) return void this.log_.debug("skip this invalid video track: ".concat(n.id, "  msid: ").concat(t.id))
                    }
                    Tu({
                        eventType: "ontrack",
                        kind: n.kind
                    });
                    var i = !1,
                        a = this.remoteStreams_.get(t.id),
                        o = t.id === Yo ? "main" : "auxiliary";
                    if (Du(a) && ((a = new Fg({
                        type: o,
                        userId: this.userId_,
                        client: this.client_
                    })).setConnection(this), this.remoteStreams_.set(t.id, a), i = !0), a.setMediaStream(t), n.kind === Fs ? a.updateAudioPlayingState(this.subscribeState_.audio) : "main" === o ? a.updateVideoPlayingState(this.subscribeState_.video) : a.updateVideoPlayingState(this.subscribeState_.auxiliary), ("auxiliary" !== o || this.trackState_.auxiliary) && ("main" !== o || this.trackState_.audio || this.trackState_.video)) {
                        var s = this.client_.getSubscriptionManager();
                        s && s.hasAutoRecoveryFlag(this.userId_, o) || (i ? this.emitter_.emit(Vv, {
                            stream: a
                        }) : this.emitter_.emit(Fv, {
                            stream: a
                        }))
                    }
                }
            }, {
                key: "addRRTRLine",
                value: function (e) {
                    var t = e.split("\r\n"),
                        n = new Map;
                    t.forEach((function (e, r) {
                        /^a=rtcp-fb:/.test(e) && t[r + 1] && !/^a=rtcp-fb:/.test(t[r + 1]) && n.set(r + 1, e.match(/^a=rtcp-fb:\d+/)[0] + " rrtr")
                    }));
                    for (var r = S(n), i = 0; i < r.length; i++) {
                        var a = g(r[i], 2),
                            o = a[0],
                            s = a[1];
                        t.splice(o + i, 0, s)
                    }
                    return t.join("\r\n")
                }
            }, {
                key: "addSPSDescription",
                value: function (e) {
                    var t = lv(e);
                    return t.media.forEach((function (e) {
                        e.type === js && e.fmtp.forEach((function (e) {
                            e.config += ";sps-pps-idr-in-keyframe=1"
                        }))
                    })), hv(t)
                }
            }, {
                key: "removeSDESDescription",
                value: function (e) {
                    var t = ["urn:ietf:params:rtp-hdrext:sdes:mid", "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id", "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"],
                        n = lv(e);
                    return n.media.forEach((function (e) {
                        e.ext = e.ext.filter((function (e) {
                            return !t.includes(e.uri)
                        }))
                    })), hv(n)
                }
            }, {
                key: "isSubscriptionStateNotChanged",
                value: function (e, t) {
                    return "main" === e.getType() ? !Du(t.audio) && !Du(t.video) && t.audio === this.subscribeState_.audio && t.video === this.subscribeState_.video : "auxiliary" === e.getType() ? !Du(t.video) && this.subscribeState_.auxiliary === t.video : void 0
                }
            }, {
                key: "subscribe",
                value: (h = i(regeneratorRuntime.mark((function e(t, n) {
                    var r, i, a, o;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (r = n.emitEvent, i = void 0 === r || r, a = t.getType(), !this.isSubscriptionStateNotChanged(t, n)) {
                                e.next = 13;
                                break
                            }
                            if (!this.peerConnection_) {
                                e.next = 8;
                                break
                            }
                            return e.next = 6, this.waitForPeerConnectionConnected();
                        case 6:
                            e.next = 11;
                            break;
                        case 8:
                            return this.initialize(), e.next = 11, this.connect();
                        case 11:
                            return i && this.emitter_.emit(jv, {
                                stream: t,
                                result: !0
                            }), e.abrupt("return", t);
                        case 13:
                            if ("main" === a ? (Du(n.audio) || (this.subscribeState_.audio = n.audio), Du(n.video) || (this.subscribeState_.video = n.video), this.addEventInternal(this.subscribeState_.audio ? Ef : Cf, this.subscribeState_.audio ? "subscribe audio" : "unsubscribe audio"), this.addEventInternal(this.subscribeState_.video ? Ef : Cf, this.subscribeState_.video ? "subscribe video" : "unsubscribe video")) : Du(n.video) || (this.subscribeState_.auxiliary = n.video), this.log_.info("subscribe ".concat(a, " stream with options ").concat(JSON.stringify(n), " current state: ").concat(JSON.stringify(this.subscribeState_))), !this.peerConnection_ && !this.isSDPExchanging_) {
                                e.next = 23;
                                break
                            }
                            return o = Ps, this.isMainStreamSubscribed || this.isAuxStreamSubscribed || (o = As), e.next = 20, this.sendSubscription(t, o);
                        case 20:
                            "main" === a ? (t.updateAudioPlayingState(this.subscribeState_.audio), t.updateVideoPlayingState(this.subscribeState_.video)) : t.updateVideoPlayingState(this.subscribeState_.auxiliary), e.next = 26;
                            break;
                        case 23:
                            return this.initialize(), e.next = 26, this.connect();
                        case 26:
                            return i && this.emitter_.emit(jv, {
                                stream: t,
                                result: !0
                            }), e.abrupt("return", t);
                        case 28:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e, t) {
                    return h.apply(this, arguments)
                })
            }, {
                key: "unsubscribe",
                value: (l = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if ("main" !== (n = t.getType())) {
                                e.next = 9;
                                break
                            }
                            if (this.isMainStreamSubscribed) {
                                e.next = 5;
                                break
                            }
                            return this.log_.info("main stream already unsubscribed"), e.abrupt("return", t);
                        case 5:
                            this.subscribeState_.audio = !1, this.subscribeState_.video = !1, e.next = 13;
                            break;
                        case 9:
                            if (this.isAuxStreamSubscribed) {
                                e.next = 12;
                                break
                            }
                            return this.log_.info("auxiliary stream already unsubscribed"), e.abrupt("return", t);
                        case 12:
                            this.subscribeState_.auxiliary = !1;
                        case 13:
                            return r = As, ("main" === n && this.isAuxStreamSubscribed || "auxiliary" === n && this.isMainStreamSubscribed) && (r = Ps), this.log_.info("unsubscribe ".concat(n, " stream with ").concat(JSON.stringify(this.subscribeState_))), e.next = 18, this.sendSubscription(t, r);
                        case 18:
                            return t.updateVideoPlayingState(!1), t.updateAudioPlayingState(!1), r === As && ((i = t.getMediaStream()) && i.getTracks().forEach((function (e) {
                                return i.removeTrack(e)
                            })), this.closePeerConnection(), this.emitConnectionStateChangedEvent(es)), this.addEventInternal(Cf, "unsubscribe audio"), this.addEventInternal(If, "unsubscribe video"), e.abrupt("return", t);
                        case 24:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return l.apply(this, arguments)
                })
            }, {
                key: "sendSubscription",
                value: function (e, t) {
                    var n = this;
                    return new Promise((function (r, i) {
                        var a = {
                            srctinyid: n.tinyId_,
                            userid: n.userId_,
                            audio: n.subscribeState_.audio,
                            bigVideo: n.subscribeState_.video,
                            auxVideo: n.subscribeState_.auxiliary
                        };
                        n.pendingSubscription_.length > 0 ? n.log_.debug("queue the subscription for later handling") : n.doSendSubscription(a, e, t), n.pendingSubscription_.push({
                            stream: e,
                            type: t,
                            data: a,
                            callback: function (e) {
                                var a = e.code,
                                    o = e.message;
                                if (0 === a) r();
                                else {
                                    var s = new ic({
                                        code: a,
                                        message: Z_({
                                            key: fm,
                                            data: {
                                                type: t,
                                                message: o
                                            }
                                        })
                                    });
                                    n.log_.error(s), i(s)
                                }
                            }
                        }), e.setInSubscriptionCycle(!0)
                    }))
                }
            }, {
                key: "doSendSubscription",
                value: function (e, t, n) {
                    var r = this;
                    if (!this.peerConnection_ || "connected" !== this.peerConnection_.connectionState && "completed" !== this.peerConnection_.connectionState) return this.log_.debug("try to send subscription [".concat(n, "] when peeConnection connected")), void(this.sentSubscriptionAfterConnected_ = !1);
                    t && this.pendingStreams_.push(t), this.log_.debug("doSendSubscription() send SUBSCRIBE command with data: ".concat(JSON.stringify(e))), n === Ps ? this.signalChannel_.send(sf, e) : n === As && this.signalChannel_.send(of, e), this.isSubscriptionPending_ = !0, this.subscriptionTimeout_ = setTimeout((function () {
                        if (r.isSubscriptionPending_)
                            if (r.log_.debug("subscription timeout"), r.subscriptionRetryCount_ += 1, r.subscriptionRetryCount_ <= 3) {
                                r.log_.debug("resend subscription");
                                var e = r.pendingSubscription_[0].data;
                                r.doSendSubscription(e, t, n)
                            } else r.log_.error(X_.SUBSCRIPTION_TIMEOUT), r.pendingSubscription_.shift(), r.pendingStreams_.shift(), r.isSubscriptionPending_ = !1, r.subscriptionRetryCount_ = 0, r.emitter_.emit(Bv, new ic({
                                code: rc.SUBSCRIPTION_TIMEOUT,
                                message: Z_({
                                    key: mm
                                })
                            }))
                    }), 5e3)
                }
            }, {
                key: "onSubscribeChangeResult",
                value: function (e) {
                    var t = e.data.content,
                        n = t.srctinyid;
                    if (this.hitTest(n)) {
                        var r = this.pendingSubscription_[0];
                        r && r.type === Ps && r.callback({
                            code: t.errCode,
                            message: t.errMsg
                        }), this.sendNextSubscription()
                    }
                }
            }, {
                key: "onUnsubscribeResult",
                value: function (e) {
                    var t = e.data.content,
                        n = t.srctinyid;
                    if (this.hitTest(n)) {
                        var r = this.pendingSubscription_[0];
                        r && r.type === As && r.callback({
                            code: t.errCode,
                            message: t.errMsg
                        }), this.sendNextSubscription()
                    }
                }
            }, {
                key: "connect",
                value: (c = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, e.next = 3, this.exchangeSDP();
                        case 3:
                            return e.next = 5, this.waitForPeerConnectionConnected();
                        case 5:
                            e.next = 11;
                            break;
                        case 7:
                            throw e.prev = 7, e.t0 = e.catch(0), this.closePeerConnection(!0), e.t0;
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 7]
                    ])
                }))), function () {
                    return c.apply(this, arguments)
                })
            }, {
                key: "exchangeSDP",
                value: (o = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i, a;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, this.isSDPExchanging_ = !0, e.next = 4, this.createOffer();
                        case 4:
                            return this.log_.info("createOffer success, sending offer to remote server"), t = this.peerConnection_.localDescription, n = t.type, r = t.sdp, i = {
                                type: n,
                                sdp: r,
                                userid: this.userId_,
                                srctinyid: this.tinyId_,
                                audio: this.subscribeState_.audio,
                                bigVideo: this.subscribeState_.video,
                                auxVideo: this.subscribeState_.auxiliary
                            }, lg.emit(hg.CONNECTION_SEND_SUBSCRIBE_CMD, {
                                client: this.client_,
                                connection: this,
                                userId: this.userId_,
                                tinyId: this.tinyId_,
                                role: Qo,
                                subscribeState: this.subscribeState_,
                                trackState: this.trackState_
                            }), e.next = 10, this.signalChannel_.sendWaitForResponse({
                                command: af,
                                commandDesc: "exchange sdp",
                                data: i,
                                responseCommand: qp.SUBSCRIBE_RESULT
                            });
                        case 10:
                            return a = e.sent, e.next = 13, this.onSubscribeResult(a);
                        case 13:
                            this.isSDPExchanging_ = !1, e.next = 20;
                            break;
                        case 16:
                            throw e.prev = 16, e.t0 = e.catch(0), this.isSDPExchanging_ = !1, e.t0;
                        case 20:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 16]
                    ])
                }))), function () {
                    return o.apply(this, arguments)
                })
            }, {
                key: "createOffer",
                value: (r = i(regeneratorRuntime.mark((function e() {
                    var t, n;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return t = {
                                voiceActivityDetection: !1
                            }, "RTCPeerConnection" in window && "addTransceiver" in window.RTCPeerConnection.prototype && "unified-plan" === this.sdpSemantics_ ? (this.peerConnection_.addTransceiver(Fs, {
                                direction: "recvonly"
                            }), this.peerConnection_.addTransceiver(js, {
                                direction: "recvonly"
                            }), this.peerConnection_.addTransceiver(js, {
                                direction: "recvonly"
                            })) : (t.offerToReceiveAudio = !0, t.offerToReceiveVideo = !0), e.next = 4, this.peerConnection_.createOffer(t);
                        case 4:
                            return (n = e.sent).sdp = this.addRRTRLine(n.sdp), n.sdp = this.addSPSDescription(n.sdp), n.sdp = pv(n.sdp), "unified-plan" === this.sdpSemantics_ && (n.sdp = this.removeSDESDescription(n.sdp)), e.next = 11, this.peerConnection_.setLocalDescription(n);
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return r.apply(this, arguments)
                })
            }, {
                key: "onSubscribeResult",
                value: (n = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a, o;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!t.data.content || 77393 !== t.data.content.errCode) {
                                e.next = 3;
                                break
                            }
                            throw this.log_.error(X_.NOT_SUPPORTED_H264DECODE), new ic({
                                code: rc.NOT_SUPPORTED_H264,
                                message: Z_(z_)
                            });
                        case 3:
                            if (n = t.data.content, r = n.type, i = n.sdp, a = n.errCode, o = n.errMsg, e.prev = 4, 0 === a) {
                                e.next = 7;
                                break
                            }
                            throw new ic({
                                code: a,
                                message: Z_({
                                    key: gm,
                                    data: {
                                        errMsg: o
                                    }
                                })
                            });
                        case 7:
                            return this.log_.debug("accept remote answer: " + i), e.next = 10, this.peerConnection_.setRemoteDescription({
                                type: r,
                                sdp: i
                            });
                        case 10:
                            this.updateSSRC(i), e.next = 17;
                            break;
                        case 13:
                            throw e.prev = 13, e.t0 = e.catch(4), this.log_.error(e.t0), e.t0;
                        case 17:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [4, 13]
                    ])
                }))), function (e) {
                    return n.apply(this, arguments)
                })
            }, {
                key: "updateSSRC",
                value: function (e) {
                    var t = this;
                    try {
                        lv(e).media.forEach((function (e) {
                            if (e.type === Fs) {
                                var n = e.ssrcs.find((function (e) {
                                    return e.value.includes(Yo)
                                }));
                                n && (t.ssrc_.audio = n.id)
                            } else {
                                var r = e.ssrcs.find((function (e) {
                                        return e.value.includes(Yo)
                                    })),
                                    i = e.ssrcs.find((function (e) {
                                        return e.value.includes($o)
                                    }));
                                r && (t.ssrc_.video = r.id), i && (t.ssrc_.auxiliary = i.id)
                            }
                        }))
                    } catch (GS) {}
                }
            }, {
                key: "sendNextSubscription",
                value: function () {
                    void 0 !== this.pendingSubscription_.shift() && (this.subscriptionRetryCount_ = 0, this.isSubscriptionPending_ = !1, -1 !== this.subscriptionTimeout_ && (clearTimeout(this.subscriptionTimeout_), this.subscriptionTimeout_ = -1));
                    var e = this.pendingStreams_.shift();
                    if (e && (this.log_.debug("mark ".concat(e.getType(), " stream exit subscription cycle")), e.setInSubscriptionCycle(!1)), this.pendingSubscription_.length > 0) {
                        var t = this.pendingSubscription_[0];
                        this.log_.info("schedule a pending subscription"), this.doSendSubscription(t.data, t.stream, t.type)
                    }
                }
            }, {
                key: "setRemoteStream",
                value: function (e, t) {
                    this.remoteStreams_.set(e, t)
                }
            }, {
                key: "getSubscribeState",
                value: function () {
                    return this.subscribeState_
                }
            }, {
                key: "getTrackState",
                value: function () {
                    return this.trackState_
                }
            }, {
                key: "getSSRC",
                value: function () {
                    return this.ssrc_
                }
            }, {
                key: "getMainStream",
                value: function () {
                    return this.remoteStreams_.get(Yo)
                }
            }, {
                key: "getAuxStream",
                value: function () {
                    return this.remoteStreams_.get($o)
                }
            }, {
                key: "getMainStreamVideoTrackId",
                value: function () {
                    var e = this.getMainStream();
                    if (e) {
                        var t = e.getVideoTrack();
                        if (t) return t.id
                    }
                    return ""
                }
            }, {
                key: "getAuxStreamVideoTrackId",
                value: function () {
                    var e = this.getAuxStream();
                    if (e) {
                        var t = e.getVideoTrack();
                        if (t) return t.id
                    }
                    return ""
                }
            }, {
                key: "reconnect",
                value: (t = i(regeneratorRuntime.mark((function e() {
                    var t, n, r = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (-1 === this.reconnectionTimer_) {
                                e.next = 3;
                                break
                            }
                            return this.log_.warn("reconnect() downlink is reconnecting, ignore current reconnection"), e.abrupt("return");
                        case 3:
                            if (!(this.reconnectionCount_ >= 30)) {
                                e.next = 12;
                                break
                            }
                            return this.log_.warn("SDK has tried reconnect downlink [".concat(this.userId_, "] for ").concat(30, " times, but all failed, please check your network")), this.stopReconnection(), t = new ic({
                                code: rc.DOWNLINK_RECONNECTION_FAILED,
                                message: Z_({
                                    key: vm
                                })
                            }), bu({
                                eventType: vs,
                                error: t
                            }), this.addEventInternal(Xf, "downlink-connection reconnect fail"), this.emitConnectionStateChangedEvent(es), this.emitter_.emit(Bv, t), e.abrupt("return");
                        case 12:
                            if (this.signalChannel_.getCurrentState() === Jp) {
                                e.next = 16;
                                break
                            }
                            return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"), this.signalChannel_.once(Fp, this.reconnect, this), e.abrupt("return");
                        case 16:
                            if (this.reconnectionCount_++, this.log_.warn("reconnect() try to reconnect downlink [".concat(this.reconnectionCount_, "/").concat(30, "]")), n = Au(this.reconnectionCount_), this.reconnectionTimer_ = setTimeout((function () {
                                r.log_.warn("reconnect() downlink [".concat(r.userId_, "] reconnect timeout(").concat(n / 1e3, "s), try again")), r.clearReconnectionTimer(), r.reconnect()
                            }), n), !(this.isSDPExchanging_ || this.peerConnection_ && "connecting" === this.peerConnection_.connectionState)) {
                                e.next = 22;
                                break
                            }
                            return e.abrupt("return");
                        case 22:
                            return e.prev = 22, this.closePeerConnection(), this.sentSubscriptionAfterConnected_ = !1, this.initialize(), e.next = 28, this.connect();
                        case 28:
                            this.stopReconnection(), this.log_.warn("reconnect() downlink reconnect successfully"), ku({
                                eventType: vs
                            }), this.addEventInternal(Qf, "downlink-connection reconnect success"), this.recoverSubscription(), e.next = 37;
                            break;
                        case 35:
                            e.prev = 35, e.t0 = e.catch(22);
                        case 37:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [22, 35]
                    ])
                }))), function () {
                    return t.apply(this, arguments)
                })
            }, {
                key: "recoverSubscription",
                value: function () {
                    var e = this,
                        t = this.client_.getSubscriptionManager();
                    t && S(this.remoteStreams_.values()).forEach((function (n) {
                        t.hasAutoRecoveryFlag(e.userId_, n.getType()) && t.recover(n)
                    }))
                }
            }, {
                key: "getIsReconnecting",
                value: function () {
                    return this.isReconnecting_
                }
            }, {
                key: "getSubscribedMainStream",
                value: function () {
                    var e = null;
                    return this.isMainStreamSubscribed && (e = this.remoteStreams_.get(Yo)), e
                }
            }, {
                key: "clearReconnectionTimer",
                value: function () {
                    -1 !== this.reconnectionTimer_ && (clearTimeout(this.reconnectionTimer_), this.reconnectionTimer_ = -1)
                }
            }, {
                key: "startReconnection",
                value: function () {
                    var e = this.client_.getSubscriptionManager();
                    if (e) {
                        var t, n = k(this.remoteStreams_.values());
                        try {
                            for (n.s(); !(t = n.n()).done;) {
                                var r = t.value,
                                    i = r.getType();
                                ("main" === i && (this.trackState_.audio || this.trackState_.video) || "auxiliary" === i && this.trackState_.auxiliary) && e.setAutoRecoveryFlag(this.userId_, r.getType())
                            }
                        } catch (a) {
                            n.e(a)
                        } finally {
                            n.f()
                        }
                    }
                    v(d(f.prototype), "startReconnection", this).call(this)
                }
            }, {
                key: "getCurrentState",
                value: function () {
                    return this.currentState_
                }
            }]), f
        }(Pg),
        Wg = function (e) {
            return function (t, n, r, i) {
                ne(n);
                var a = se(t),
                    o = F(a),
                    s = ot(a),
                    c = e ? s - 1 : 0,
                    u = e ? -1 : 1;
                if (r < 2)
                    for (;;) {
                        if (c in o) {
                            i = o[c], c += u;
                            break
                        }
                        if (c += u, e ? c < 0 : s <= c) throw TypeError("Reduce of empty array with no initial value")
                    }
                for (; e ? c >= 0 : s > c; c += u) c in o && (i = n(i, o[c], c, a));
                return i
            }
        },
        qg = {
            left: Wg(!1),
            right: Wg(!0)
        }.left,
        Kg = Ka("reduce");
    Et({
        target: "Array",
        proto: !0,
        forced: !Kg || !dh && Y > 79 && Y < 83
    }, {
        reduce: function (e) {
            return qg(this, e, arguments.length, arguments.length > 1 ? arguments[1] : void 0)
        }
    });
    var Qg = function () {
            function e() {
                a(this, e), this.startTime = 0, this.endTime = 0, this.start()
            }
            return s(e, [{
                key: "start",
                value: function () {
                    0 === this.startTime && (this.startTime = Vu())
                }
            }, {
                key: "stop",
                value: function () {
                    0 === this.endTime && (this.endTime = Vu())
                }
            }, {
                key: "getDuration",
                value: function () {
                    return 0 === this.endTime ? Vu() - this.startTime : this.endTime - this.startTime
                }
            }]), e
        }(),
        Xg = function () {
            function e(t) {
                a(this, e), this.client_ = t.client, this.intervalId_ = -1, this.statsCalculator_ = new ug, this.prevStats_ = null, this.renderFreezeMap_ = new Map, this.remoteStreamMap_ = new Map, this.dataFreezeMap_ = new Map, this.monitorFreezeData_ = new Map
            }
            var t, n, r;
            return s(e, [{
                key: "installEvents",
                value: function () {
                    lg.on(hg.PLAY_VIDEO_START, this.handlePlayVideoStart, this), lg.on(hg.VIDEO_TRACK_MUTED, this.onVideoTrackMuted, this), lg.on(hg.VIDEO_TRACK_UNMUTED, this.onVideoTrackUnmuted, this), lg.on(hg.REMOTE_STREAM_REMOVED, this.handleStreamStopped, this), lg.on(hg.REMOTE_STREAM_UNSUBSCRIBED, this.handleStreamStopped, this), lg.on(hg.VIDEO_PLAYING, this.handleVideoPlaying, this)
                }
            }, {
                key: "uninstallEvents",
                value: function () {
                    lg.off(hg.PLAY_VIDEO_START, this.handlePlayVideoStart, this), lg.off(hg.VIDEO_TRACK_MUTED, this.onVideoTrackMuted, this), lg.off(hg.VIDEO_TRACK_UNMUTED, this.onVideoTrackUnmuted, this), lg.off(hg.REMOTE_STREAM_REMOVED, this.handleStreamStopped, this), lg.off(hg.REMOTE_STREAM_UNSUBSCRIBED, this.handleStreamStopped, this), lg.off(hg.VIDEO_PLAYING, this.handleVideoPlaying, this)
                }
            }, {
                key: "start",
                value: function () {
                    var e = this; - 1 === this.intervalId_ && (this.installEvents(), this.intervalId_ = Tl.setInterval(i(regeneratorRuntime.mark((function t() {
                        return regeneratorRuntime.wrap((function (t) {
                            for (;;) switch (t.prev = t.next) {
                            case 0:
                                return t.prev = 0, t.next = 3, e.detectFPS();
                            case 3:
                                t.next = 7;
                                break;
                            case 5:
                                t.prev = 5, t.t0 = t.catch(0);
                            case 7:
                            case "end":
                                return t.stop()
                            }
                        }), t, null, [
                            [0, 5]
                        ])
                    }))), 1e3))
                }
            }, {
                key: "stop",
                value: function () {
                    -1 !== this.intervalId_ && (this.uninstallEvents(), Tl.clearInterval(this.intervalId_), this.intervalId_ = -1, this.renderFreezeMap_.clear(), this.dataFreezeMap_.clear(), this.remoteStreamMap_.clear())
                }
            }, {
                key: "onVideoTrackMuted",
                value: function (e) {
                    var t = e.stream;
                    if (t.getClient() === this.client_ && t.isRemote()) {
                        var n = t.userId_,
                            r = t.type_,
                            i = "".concat(n, "_").concat(r),
                            a = this.dataFreezeMap_.get(i),
                            o = new Qg;
                        a ? a.durationItemList.push(o) : this.dataFreezeMap_.set(i, {
                            userId: n,
                            type: r,
                            durationItemList: [o],
                            isFreezing: function () {
                                var e = this.durationItemList[this.durationItemList.length - 1];
                                return e && 0 === e.endTime
                            }
                        })
                    }
                }
            }, {
                key: "onVideoTrackUnmuted",
                value: function (e) {
                    var t = e.stream;
                    if (t.getClient() === this.client_ && t.isRemote()) {
                        var n = t.userId_,
                            r = t.type_,
                            i = "".concat(n, "_").concat(r);
                        this.stopDataFreeze({
                            key: i,
                            userId: n,
                            type: r
                        })
                    }
                }
            }, {
                key: "handleStreamStopped",
                value: function (e) {
                    var t = e.client,
                        n = e.stream;
                    if (t === this.client_) {
                        var r = n.getUserId(),
                            i = n.getType(),
                            a = "".concat(r, "_").concat(i);
                        this.stopDataFreeze({
                            key: a,
                            userId: r,
                            type: i
                        })
                    }
                }
            }, {
                key: "stopDataFreeze",
                value: function (e) {
                    var t = e.key,
                        n = e.userId,
                        r = e.type,
                        i = this.dataFreezeMap_.get(t);
                    if (i && i.isFreezing()) {
                        var a = i.durationItemList[i.durationItemList.length - 1];
                        a.stop();
                        var o = a.getDuration();
                        o > 500 ? (Tu({
                            eventType: "videoFrozenCount",
                            delta: o
                        }), this.monitorFreezeData_.set(t, {
                            userId: n,
                            type: r,
                            duration: o
                        })) : i.durationItemList.pop()
                    }
                }
            }, {
                key: "getTotalDuration",
                value: function (e) {
                    return e.reduce((function (e, t) {
                        var n = t.getDuration();
                        return e + Math.min(n, 5e3)
                    }), 0)
                }
            }, {
                key: "getStats",
                value: (r = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i, a, o, s, c, u, d, l;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            t = this.client_.getConnections(), n = {}, r = k(t), e.prev = 3, r.s();
                        case 5:
                            if ((i = r.n()).done) {
                                e.next = 20;
                                break
                            }
                            if (a = g(i.value, 2), o = a[0], (s = a[1]).getPeerConnection()) {
                                e.next = 9;
                                break
                            }
                            return e.abrupt("continue", 18);
                        case 9:
                            return c = s.getSubscribeState(), u = s.getTrackState(), e.next = 13, this.statsCalculator_.getReceiverStats(s);
                        case 13:
                            d = e.sent, (l = {
                                userId: d.userId,
                                tinyId: o,
                                hasVideo: u.video && c.video,
                                hasAuxiliary: u.auxiliary && c.auxiliary,
                                video: {
                                    framesDecoded: 0
                                },
                                auxiliary: {
                                    framesDecoded: 0
                                }
                            }).hasVideo && (l.video.framesDecoded = d.video.framesDecoded), l.hasAuxiliary && (l.auxiliary.framesDecoded = d.auxiliary.framesDecoded), n[d.userId] = l;
                        case 18:
                            e.next = 5;
                            break;
                        case 20:
                            e.next = 25;
                            break;
                        case 22:
                            e.prev = 22, e.t0 = e.catch(3), r.e(e.t0);
                        case 25:
                            return e.prev = 25, r.f(), e.finish(25);
                        case 28:
                            return e.abrupt("return", n);
                        case 29:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [3, 22, 25, 28]
                    ])
                }))), function () {
                    return r.apply(this, arguments)
                })
            }, {
                key: "detectFPS",
                value: (n = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i, a, o;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.next = 2, this.getStats();
                        case 2:
                            if (t = e.sent, this.prevStats_) {
                                e.next = 6;
                                break
                            }
                            return this.prevStats_ = t, e.abrupt("return");
                        case 6:
                            e.t0 = regeneratorRuntime.keys(t);
                        case 7:
                            if ((e.t1 = e.t0()).done) {
                                e.next = 17;
                                break
                            }
                            if (n = e.t1.value, this.prevStats_[n]) {
                                e.next = 11;
                                break
                            }
                            return e.abrupt("continue", 7);
                        case 11:
                            r = t[n].tinyId, i = this.client_.getMutedStates(), t[n].hasVideo && this.prevStats_[n].hasVideo && i.has(r) && !i.get(r).videoMuted && (a = t[n].video.framesDecoded - this.prevStats_[n].video.framesDecoded, this.handleRenderFreeze({
                                userId: n,
                                type: "main",
                                fps: a
                            })), t[n].hasAuxiliary && this.prevStats_[n].hasAuxiliary && (o = t[n].auxiliary.framesDecoded - this.prevStats_[n].auxiliary.framesDecoded, this.handleRenderFreeze({
                                userId: n,
                                type: "auxiliary",
                                fps: o
                            })), e.next = 7;
                            break;
                        case 17:
                            this.prevStats_ = t;
                        case 18:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return n.apply(this, arguments)
                })
            }, {
                key: "handleRenderFreeze",
                value: (t = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a, o, s, c, u;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            n = t.userId, r = t.fps, i = t.type, a = "".concat(n, "_").concat(i), o = this.renderFreezeMap_.get(a), r <= 2 ? (s = Vu(), o && !o.isFreeze && (o.freezeTimeline.push({
                                startTime: s,
                                endTime: void 0
                            }), o.isFreeze = !0), o || this.renderFreezeMap_.set(a, {
                                userId: n,
                                type: i,
                                isFreeze: !0,
                                freezeTimeline: [{
                                    startTime: s,
                                    endTime: void 0
                                }],
                                renderFreezeTotal: 0
                            })) : o && o.isFreeze && (o.isFreeze = !1, (c = o.freezeTimeline.pop()).endTime = Vu(), u = c.endTime - c.startTime, o.freezeTimeline.push(c), o.renderFreezeTotal += Math.min(5e3, u));
                        case 4:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return t.apply(this, arguments)
                })
            }, {
                key: "handlePlayVideoStart",
                value: function (e) {
                    var t = e.stream;
                    if (t.getClient() === this.client_ && t.isRemote() && t.hasVideo()) {
                        var n = "".concat(t.getUserId(), "_").concat(t.getType());
                        if (this.remoteStreamMap_.has(n)) this.remoteStreamMap_.get(n).remoteStream = t;
                        else this.remoteStreamMap_.set(n, {
                            isPlayingFired: !1,
                            remoteStream: t
                        })
                    }
                }
            }, {
                key: "handleVideoPlaying",
                value: function (e) {
                    var t = e.stream;
                    if (t.isRemote() && t.getClient() === this.client_) {
                        var n = "".concat(t.getUserId(), "_").concat(t.getType());
                        if (this.remoteStreamMap_.has(n)) this.remoteStreamMap_.get(n).isPlayingFired = !0
                    }
                }
            }, {
                key: "getDataFreezeDuration",
                value: function (e) {
                    var t = {
                            dataFreeze: 0,
                            count: 0
                        },
                        n = this.dataFreezeMap_.get(e);
                    if (n) {
                        if (n.isFreezing()) {
                            var r = n.durationItemList[n.durationItemList.length - 1];
                            r.stop(), r.getDuration() < 500 && n.durationItemList.pop()
                        }
                        t.dataFreeze = this.getTotalDuration(n.durationItemList), t.count = n.durationItemList.length
                    }
                    return t
                }
            }, {
                key: "getRenderFreezeDuration",
                value: function (e) {
                    var t = this.renderFreezeMap_.get(e),
                        n = 0,
                        r = 0;
                    if (t)
                        if (t.isFreeze) {
                            var i = Vu() - t.freezeTimeline[t.freezeTimeline.length - 1].startTime;
                            n = t.renderFreezeTotal + Math.min(i, 5e3), r = t.freezeTimeline.length
                        } else n = t.renderFreezeTotal;
                    return {
                        renderFreeze: n,
                        count: r
                    }
                }
            }, {
                key: "getMonitorFreeze",
                value: function () {
                    return this.monitorFreezeData_
                }
            }, {
                key: "isBlackStream",
                value: function (e) {
                    return !!this.remoteStreamMap_.has(e) && !this.remoteStreamMap_.get(e).isPlayingFired
                }
            }, {
                key: "resetMonitor",
                value: function () {
                    this.monitorFreezeData_.clear()
                }
            }]), e
        }(),
        Yg = function e(t) {
            a(this, e), this.userId = t.userId, this.tinyId = t.tinyId, this.role = t.role === Qo ? "anchor" : "audience"
        };

    function $g(e) {
        var t = e.retryFunction,
            n = e.settings,
            r = e.onError,
            a = e.onRetrying,
            o = e.context;
        return function () {
            for (var e = this, s = arguments.length, c = new Array(s), u = 0; u < s; u++) c[u] = arguments[u];
            var d = n.retries || 5,
                l = 0,
                h = -1,
                p = 0,
                f = function () {
                    var s = i(regeneratorRuntime.mark((function i(s, u) {
                        var m, _, v, g;
                        return regeneratorRuntime.wrap((function (i) {
                            for (;;) switch (i.prev = i.next) {
                            case 0:
                                return i.prev = 0, m = o || e, i.next = 4, t.apply(m, c);
                            case 4:
                                _ = i.sent, l = 0, s(_), i.next = 14;
                                break;
                            case 9:
                                i.prev = 9, i.t0 = i.catch(0), v = function () {
                                    clearTimeout(h), l = 0, p = 2, u(i.t0)
                                }, g = function () {
                                    2 !== p && l < d ? (l++, p = 1, Pu(a) && a(l, v), h = setTimeout((function () {
                                        h = -1, f(s, u)
                                    }), n.timeout || 1e3)) : v()
                                }, r(i.t0, g, u);
                            case 14:
                            case "end":
                                return i.stop()
                            }
                        }), i, null, [
                            [0, 9]
                        ])
                    })));
                    return function (e, t) {
                        return s.apply(this, arguments)
                    }
                }();
            return new Promise(f)
        }
    }
    var Zg = E((function (e) {
            ! function (t) {
                function n(e, t) {
                    var n = (65535 & e) + (65535 & t);
                    return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n
                }

                function r(e, t, r, i, a, o) {
                    return n((s = n(n(t, e), n(i, o))) << (c = a) | s >>> 32 - c, r);
                    var s, c
                }

                function i(e, t, n, i, a, o, s) {
                    return r(t & n | ~t & i, e, t, a, o, s)
                }

                function a(e, t, n, i, a, o, s) {
                    return r(t & i | n & ~i, e, t, a, o, s)
                }

                function o(e, t, n, i, a, o, s) {
                    return r(t ^ n ^ i, e, t, a, o, s)
                }

                function s(e, t, n, i, a, o, s) {
                    return r(n ^ (t | ~i), e, t, a, o, s)
                }

                function c(e, t) {
                    var r, c, u, d, l;
                    e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t;
                    var h = 1732584193,
                        p = -271733879,
                        f = -1732584194,
                        m = 271733878;
                    for (r = 0; r < e.length; r += 16) c = h, u = p, d = f, l = m, h = i(h, p, f, m, e[r], 7, -680876936), m = i(m, h, p, f, e[r + 1], 12, -389564586), f = i(f, m, h, p, e[r + 2], 17, 606105819), p = i(p, f, m, h, e[r + 3], 22, -1044525330), h = i(h, p, f, m, e[r + 4], 7, -176418897), m = i(m, h, p, f, e[r + 5], 12, 1200080426), f = i(f, m, h, p, e[r + 6], 17, -1473231341), p = i(p, f, m, h, e[r + 7], 22, -45705983), h = i(h, p, f, m, e[r + 8], 7, 1770035416), m = i(m, h, p, f, e[r + 9], 12, -1958414417), f = i(f, m, h, p, e[r + 10], 17, -42063), p = i(p, f, m, h, e[r + 11], 22, -1990404162), h = i(h, p, f, m, e[r + 12], 7, 1804603682), m = i(m, h, p, f, e[r + 13], 12, -40341101), f = i(f, m, h, p, e[r + 14], 17, -1502002290), h = a(h, p = i(p, f, m, h, e[r + 15], 22, 1236535329), f, m, e[r + 1], 5, -165796510), m = a(m, h, p, f, e[r + 6], 9, -1069501632), f = a(f, m, h, p, e[r + 11], 14, 643717713), p = a(p, f, m, h, e[r], 20, -373897302), h = a(h, p, f, m, e[r + 5], 5, -701558691), m = a(m, h, p, f, e[r + 10], 9, 38016083), f = a(f, m, h, p, e[r + 15], 14, -660478335), p = a(p, f, m, h, e[r + 4], 20, -405537848), h = a(h, p, f, m, e[r + 9], 5, 568446438), m = a(m, h, p, f, e[r + 14], 9, -1019803690), f = a(f, m, h, p, e[r + 3], 14, -187363961), p = a(p, f, m, h, e[r + 8], 20, 1163531501), h = a(h, p, f, m, e[r + 13], 5, -1444681467), m = a(m, h, p, f, e[r + 2], 9, -51403784), f = a(f, m, h, p, e[r + 7], 14, 1735328473), h = o(h, p = a(p, f, m, h, e[r + 12], 20, -1926607734), f, m, e[r + 5], 4, -378558), m = o(m, h, p, f, e[r + 8], 11, -2022574463), f = o(f, m, h, p, e[r + 11], 16, 1839030562), p = o(p, f, m, h, e[r + 14], 23, -35309556), h = o(h, p, f, m, e[r + 1], 4, -1530992060), m = o(m, h, p, f, e[r + 4], 11, 1272893353), f = o(f, m, h, p, e[r + 7], 16, -155497632), p = o(p, f, m, h, e[r + 10], 23, -1094730640), h = o(h, p, f, m, e[r + 13], 4, 681279174), m = o(m, h, p, f, e[r], 11, -358537222), f = o(f, m, h, p, e[r + 3], 16, -722521979), p = o(p, f, m, h, e[r + 6], 23, 76029189), h = o(h, p, f, m, e[r + 9], 4, -640364487), m = o(m, h, p, f, e[r + 12], 11, -421815835), f = o(f, m, h, p, e[r + 15], 16, 530742520), h = s(h, p = o(p, f, m, h, e[r + 2], 23, -995338651), f, m, e[r], 6, -198630844), m = s(m, h, p, f, e[r + 7], 10, 1126891415), f = s(f, m, h, p, e[r + 14], 15, -1416354905), p = s(p, f, m, h, e[r + 5], 21, -57434055), h = s(h, p, f, m, e[r + 12], 6, 1700485571), m = s(m, h, p, f, e[r + 3], 10, -1894986606), f = s(f, m, h, p, e[r + 10], 15, -1051523), p = s(p, f, m, h, e[r + 1], 21, -2054922799), h = s(h, p, f, m, e[r + 8], 6, 1873313359), m = s(m, h, p, f, e[r + 15], 10, -30611744), f = s(f, m, h, p, e[r + 6], 15, -1560198380), p = s(p, f, m, h, e[r + 13], 21, 1309151649), h = s(h, p, f, m, e[r + 4], 6, -145523070), m = s(m, h, p, f, e[r + 11], 10, -1120210379), f = s(f, m, h, p, e[r + 2], 15, 718787259), p = s(p, f, m, h, e[r + 9], 21, -343485551), h = n(h, c), p = n(p, u), f = n(f, d), m = n(m, l);
                    return [h, p, f, m]
                }

                function u(e) {
                    var t, n = "",
                        r = 32 * e.length;
                    for (t = 0; t < r; t += 8) n += String.fromCharCode(e[t >> 5] >>> t % 32 & 255);
                    return n
                }

                function d(e) {
                    var t, n = [];
                    for (n[(e.length >> 2) - 1] = void 0, t = 0; t < n.length; t += 1) n[t] = 0;
                    var r = 8 * e.length;
                    for (t = 0; t < r; t += 8) n[t >> 5] |= (255 & e.charCodeAt(t / 8)) << t % 32;
                    return n
                }

                function l(e) {
                    var t, n, r = "";
                    for (n = 0; n < e.length; n += 1) t = e.charCodeAt(n), r += "0123456789abcdef".charAt(t >>> 4 & 15) + "0123456789abcdef".charAt(15 & t);
                    return r
                }

                function h(e) {
                    return unescape(encodeURIComponent(e))
                }

                function p(e) {
                    return function (e) {
                        return u(c(d(e), 8 * e.length))
                    }(h(e))
                }

                function f(e, t) {
                    return function (e, t) {
                        var n, r, i = d(e),
                            a = [],
                            o = [];
                        for (a[15] = o[15] = void 0, i.length > 16 && (i = c(i, 8 * e.length)), n = 0; n < 16; n += 1) a[n] = 909522486 ^ i[n], o[n] = 1549556828 ^ i[n];
                        return r = c(a.concat(d(t)), 512 + 8 * t.length), u(c(o.concat(r), 640))
                    }(h(e), h(t))
                }

                function m(e, t, n) {
                    return t ? n ? f(t, e) : l(f(t, e)) : n ? p(e) : l(p(e))
                }
                e.exports ? e.exports = m : t.md5 = m
            }(R)
        })),
        eS = function () {
            function e(t) {
                a(this, e), this.client_ = t.client, this.signalChannel_ = t.signalChannel, this.isMixing_ = !1, this.config_ = null, this.data_ = null, this.remoteStreamMap_ = new Map, this.installEvents()
            }
            var t, n;
            return s(e, [{
                key: "isPresetLayoutMode",
                get: function () {
                    return this.config_ && this.config_.mode === Ds.PRESET_LAYOUT
                }
            }, {
                key: "installEvents",
                value: function () {
                    lg.on(hg.REMOTE_STREAM_SUBSCRIBED, this.onStreamSubscribed, this), lg.on(hg.REMOTE_STREAM_UNSUBSCRIBED, this.onStreamUnsubscribed, this), this.client_.on("stream-removed", this.onStreamRemoved, this)
                }
            }, {
                key: "uninstallEvents",
                value: function () {
                    lg.off(hg.REMOTE_STREAM_SUBSCRIBED, this.onStreamSubscribed, this), lg.off(hg.REMOTE_STREAM_UNSUBSCRIBED, this.onStreamUnsubscribed, this), this.client_.off("stream-removed", this.onStreamRemoved, this)
                }
            }, {
                key: "stop",
                value: function () {
                    this.uninstallEvents()
                }
            }, {
                key: "onStreamSubscribed",
                value: function (e) {
                    var t = e.client,
                        n = e.stream;
                    t === this.client_ && (this.remoteStreamMap_.set(n.getId(), {
                        remoteStream: n,
                        isUsed: !1
                    }), this.isMixing_ && this.hasAvailablePlaceHolder() && this.startMixTranscode(this.config_))
                }
            }, {
                key: "onStreamUnsubscribed",
                value: function (e) {
                    var t = e.client,
                        n = e.stream;
                    t === this.client_ && this.onStreamRemoved({
                        stream: n
                    })
                }
            }, {
                key: "onStreamRemoved",
                value: function (e) {
                    var t = e.stream;
                    if (this.remoteStreamMap_.has(t.getId())) {
                        var n = this.remoteStreamMap_.get(t.getId()).isUsed;
                        this.remoteStreamMap_.delete(t.getId()), this.isMixing_ && this.isPresetLayoutMode && n && this.startMixTranscode(this.config_)
                    }
                }
            }, {
                key: "startMixTranscode",
                value: (n = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (e.prev = 0, this.resetIsUsedFlag(), this.validateMixTranscodeParamsType(t), this.config_ = t, n = this.getInputParam(t, this.remoteStreamMap_), r = this.getOutputParam(t), i = this.getOutputSessionId({
                                config: t,
                                roomId: this.client_.getRoomId(),
                                userId: this.client_.getUserId()
                            }), this.validateMixTranscodeParamsValue(n, r), !this.isMixing_ || !this.data_ || i === this.data_.outputSessionId) {
                                e.next = 12;
                                break
                            }
                            return Kd.info("startMixTranscode() streamId changed, stop mixing before start"), e.next = 12, this.doStopMixTranscode();
                        case 12:
                            return e.next = 14, this.doStartMixTranscode({
                                outputSessionId: i,
                                inputParam: n,
                                outputParam: r
                            });
                        case 14:
                            e.next = 20;
                            break;
                        case 16:
                            throw e.prev = 16, e.t0 = e.catch(0), this.resetIsUsedFlag(), e.t0;
                        case 20:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 16]
                    ])
                }))), function (e) {
                    return n.apply(this, arguments)
                })
            }, {
                key: "doStartMixTranscode",
                value: function (e) {
                    var t = this,
                        n = e.outputSessionId,
                        r = e.inputParam,
                        i = e.outputParam;
                    return new Promise((function (e, a) {
                        var o = {
                            roomid: String(t.client_.getRoomId()),
                            sdkAppID: String(t.client_.getSDKAppId()),
                            socketid: t.signalChannel_.getSocketId(),
                            mcuRequestTime: Date.now(),
                            outputSessionId: n,
                            inputParam: r,
                            outputParam: i
                        };
                        t.data_ = o, Kd.info("startMixTranscode: ".concat(JSON.stringify(o))), t.signalChannel_.send(hf, o), t.isMixing_ = !0;
                        var s = setTimeout((function () {
                                Kd.error("startMixTranscode timeout observed"), t.isMixing_ = !1, t.signalChannel_.off(qp.START_MIX_TRANSCODE_RES, c), a(new ic({
                                    code: rc.START_MIX_TRANSCODE_FAILED,
                                    message: Z_({
                                        key: b_
                                    })
                                }))
                            }), 5e3),
                            c = function (n) {
                                clearTimeout(s), n.data.content.errCode ? (Kd.error("startMixTranscode failed, errCode: ".concat(n.data.content.errCode, " errMsg: ").concat(n.data.content.errMsg)), t.isMixing_ = !1, a(new ic({
                                    code: rc.START_MIX_TRANSCODE_FAILED,
                                    message: Z_({
                                        key: R_,
                                        data: {
                                            errMsg: n.data.content.errMsg
                                        }
                                    })
                                }))) : e()
                            };
                        t.signalChannel_.once(qp.START_MIX_TRANSCODE_RES, c)
                    }))
                }
            }, {
                key: "stopMixTranscode",
                value: (t = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.isMixing_) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: C_
                                })
                            });
                        case 2:
                            return e.next = 4, this.doStopMixTranscode();
                        case 4:
                            this.resetIsUsedFlag();
                        case 5:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return t.apply(this, arguments)
                })
            }, {
                key: "doStopMixTranscode",
                value: function () {
                    var e = this;
                    return new Promise((function (t, n) {
                        var r = {
                            roomid: String(e.client_.getRoomId()),
                            sdkAppID: String(e.client_.getSDKAppId()),
                            socketid: e.signalChannel_.getSocketId(),
                            userid: e.client_.getUserId(),
                            mcuRequestTime: Date.now(),
                            outPutSessionId: e.data_.outputSessionId,
                            streamType: e.data_.outputParam.streamType
                        };
                        Kd.info("stopMixTranscode: ".concat(JSON.stringify(r))), e.signalChannel_.send(pf, r);
                        var i = setTimeout((function () {
                                Kd.error("stopMixTranscode timeout observed"), e.signalChannel_.off(qp.STOP_MIX_TRANSCODE_RES, a), n(new ic({
                                    code: rc.STOP_MIX_TRANSCODE_FAILED,
                                    message: Z_({
                                        key: E_
                                    })
                                }))
                            }), 5e3),
                            a = function (r) {
                                clearTimeout(i), r.data.content.errCode ? (Kd.error("stopMixTranscode failed, errCode: ".concat(r.data.content.errCode, " errMsg: ").concat(r.data.content.errMsg)), n(new ic({
                                    code: rc.STOP_MIX_TRANSCODE_FAILED,
                                    message: Z_({
                                        key: I_,
                                        data: {
                                            errMsg: r.data.content.errMsg
                                        }
                                    })
                                }))) : (e.isMixing_ = !1, t())
                            };
                        e.signalChannel_.once(qp.STOP_MIX_TRANSCODE_RES, a)
                    }))
                }
            }, {
                key: "validateMixTranscodeParamsType",
                value: function (e) {
                    if ("object" !== Nu(e)) throw new ic({
                        code: rc.INVALID_PARAMETER,
                        message: Z_({
                            key: w_
                        })
                    });
                    var t = Mu(e, {
                        streamId: Ns,
                        videoWidth: Ms,
                        videoHeight: Ms,
                        videoBitrate: Ms,
                        videoFramerate: Ms,
                        videoGOP: Ms,
                        audioSampleRate: Ms,
                        audioBitrate: Ms,
                        audioChannels: Ms,
                        backgroundColor: Ms,
                        backgroundImage: Ns,
                        mixUsers: Vs
                    });
                    if (!t.ret) throw new ic({
                        code: rc.INVALID_PARAMETER,
                        message: t.message
                    });
                    var n = {
                        userId: Ns,
                        roomId: this.client_.getUseStringRoomId() ? Ns : Ms,
                        pureAudio: Ls,
                        width: Ms,
                        height: Ms,
                        locationX: Ms,
                        locationY: Ms,
                        zOrder: Ms
                    };
                    e.mixUsers.forEach((function (e) {
                        var t = Mu(e, n);
                        if (!t.ret) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: "mixUser.".concat(t.message)
                        })
                    }))
                }
            }, {
                key: "getOutputSessionId",
                value: function (e) {
                    var t = e.config,
                        n = e.userId,
                        r = e.roomId;
                    return xu(t.streamId) && t.streamId.length > 0 ? t.streamId : Zg("".concat(r, "_").concat(n, "_main"))
                }
            }, {
                key: "getInputParam",
                value: function (e, t) {
                    var n = this,
                        r = e.mixUsers.map((function (e) {
                            return {
                                userid: e.userId,
                                roomid: String(e.roomId || n.client_.getRoomId()),
                                width: e.width || 0,
                                height: e.height || 0,
                                locationX: e.locationX || 0,
                                locationY: e.locationY || 0,
                                zOrder: e.zOrder,
                                streamType: Du(e.streamType) || "auxiliary" !== e.streamType ? 0 : 1,
                                inputType: e.pureAudio ? Os.IT_PURE_AUDIO : Os.IT_AUDIO_VIDEO
                            }
                        }));
                    return e.mode === Ds.PRESET_LAYOUT && (r.forEach((function (e) {
                        if (e.userid === xs.REMOTE) {
                            var n = S(t.values()).find((function (e) {
                                return !e.isUsed
                            }));
                            n && (e.userid = n.remoteStream.getUserId(), e.streamType = "auxiliary" === n.remoteStream.getType() ? 1 : 0, n.isUsed = !0)
                        }
                    })), r = r.filter((function (e) {
                        return e.userid !== xs.REMOTE
                    }))), r
                }
            }, {
                key: "getOutputParam",
                value: function (e) {
                    var t = e.streamId || "";
                    return {
                        streamId: t,
                        streamType: t.length > 0 ? 1 : 0,
                        videoWidth: Du(e.videoWidth) ? 640 : e.videoWidth,
                        videoHeight: Du(e.videoHeight) ? 480 : e.videoHeight,
                        videoBitrate: e.videoBitrate || 0,
                        videoFramerate: e.videoFramerate || 15,
                        videoGOP: e.videoGOP || 2,
                        audioSampleRate: e.audioSampleRate || 48e3,
                        audioBitrate: e.audioBitrate || 64,
                        audioChannels: e.audioChannels || 1,
                        backgroundColor: e.backgroundColor || 0,
                        backgroundImage: e.backgroundImage || "",
                        extraInfo: "",
                        VCodec: 2,
                        ACodec: 0
                    }
                }
            }, {
                key: "validateMixTranscodeParamsValue",
                value: function (e, t) {
                    var n = 0,
                        r = 0;
                    if (e.forEach((function (e) {
                        if (Du(e.userid)) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: A_
                            })
                        });
                        if (e.inputType !== Os.IT_PURE_AUDIO) {
                            if (e.width < 0 || e.height < 0) throw new ic({
                                code: rc.INVALID_PARAMETER,
                                message: Z_({
                                    key: P_
                                })
                            });
                            if (e.locationX < 0 || e.locationY < 0) throw new ic({
                                code: rc.INVALID_PARAMETER,
                                message: Z_({
                                    key: D_
                                })
                            });
                            if (!e.zOrder || e.zOrder < 1 || e > 15) throw new ic({
                                code: rc.INVALID_PARAMETER,
                                message: Z_({
                                    key: x_
                                })
                            });
                            e.width + e.locationX > n && (n = e.width + e.locationX), e.height + e.locationY > r && (r = e.height + e.locationY)
                        }
                    })), t.videoWidth < 0 || t.videoWidth < 0) throw new ic({
                        code: rc.INVALID_PARAMETER,
                        message: Z_({
                            key: O_
                        })
                    });
                    if (t.videoWidth < n || t.videoHeight < r) throw new ic({
                        code: rc.INVALID_PARAMETER,
                        message: Z_({
                            key: N_
                        })
                    })
                }
            }, {
                key: "hasAvailablePlaceHolder",
                value: function () {
                    return !!this.isPresetLayoutMode && this.data_.inputParam.length !== this.config_.mixUsers.length
                }
            }, {
                key: "resetIsUsedFlag",
                value: function () {
                    this.remoteStreamMap_.forEach((function (e) {
                        return e.isUsed = !1
                    }))
                }
            }]), e
        }(),
        tS = function () {
            function e(t) {
                a(this, e), this.client_ = t.client, this.signalChannel_ = t.signalChannel, this.isPublishingTencentCDN_ = !1, this.publishGivenCDNData_ = null, this.isPublishingGivenCDN_ = !1
            }
            return s(e, [{
                key: "getIsPublishingTencentCDN",
                value: function () {
                    return this.isPublishingTencentCDN_
                }
            }, {
                key: "getIsPublishingGivenCDN",
                value: function () {
                    return this.isPublishingGivenCDN_
                }
            }, {
                key: "startPublishTencentCDN",
                value: function (e) {
                    var t = this;
                    e = e || "".concat(this.client_.getSDKAppId(), "_").concat(this.client_.getRoomId(), "_").concat(this.client_.getUserId(), "_main");
                    var n = {
                        roomid: String(this.client_.getRoomId()),
                        sdkAppID: String(this.client_.getSDKAppId()),
                        requestTime: Date.now(),
                        sessionId: Zg("".concat(this.client_.getRoomId(), "_").concat(this.client_.getUserId(), "_main")),
                        streamId: e,
                        streamType: 0
                    };
                    return Kd.info("startPublishTencentCDN: " + JSON.stringify(n)), new Promise((function (e, r) {
                        t.isPublishingTencentCDN_ = !0;
                        var i = setTimeout((function () {
                                Kd.error("startPublishTencentCDN timeout observed"), t.isPublishingTencentCDN_ = !1, t.signalChannel_.off(qp.START_PUBLISH_TENCENT_CDN_RES, a), r(new Error("startPublishTencentCDN timeout"))
                            }), 5e3),
                            a = function (n) {
                                clearTimeout(i);
                                var a = n.data.content,
                                    o = a.errCode,
                                    s = a.errMsg;
                                0 === o ? e() : (t.isPublishingTencentCDN_ = !1, -102083 === o && (s = "Please enable relayed-push in https://console.cloud.tencent.com/trtc/ and try later, refer to https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/tutorial-26-advanced-publish-cdn-stream.html"), Kd.error("startPublishTencentCDN failed, errCode: ".concat(o, ", errMsg: ").concat(s)), r(new Error(s)))
                            };
                        t.signalChannel_.once(qp.START_PUBLISH_TENCENT_CDN_RES, a), t.signalChannel_.send(cf, n)
                    }))
                }
            }, {
                key: "stopPublishTencentCDN",
                value: function () {
                    var e = this,
                        t = {
                            roomid: String(this.client_.getRoomId()),
                            sdkAppID: String(this.client_.getSDKAppId()),
                            requestTime: Date.now(),
                            sessionId: Zg("".concat(this.client_.getRoomId(), "_").concat(this.client_.getUserId(), "_main"))
                        };
                    return Kd.info("stopPublishTencentCDN: " + JSON.stringify(t)), new Promise((function (n, r) {
                        var i = setTimeout((function () {
                                Kd.error("stopPublishTencentCDN timeout observed"), e.signalChannel_.off(qp.STOP_PUBLISH_TENCENT_CDN_RES, a), r(new Error("stopPublishTencentCDN timeout"))
                            }), 5e3),
                            a = function (t) {
                                clearTimeout(i);
                                var a = t.data.content,
                                    o = a.errCode,
                                    s = a.errMsg;
                                0 === o ? (e.isPublishingTencentCDN_ = !1, n()) : -102069 === o ? (Kd.warn("stopPublishTencentCDN failed, can not stopPublishTencentCDN in auto relayed-push mode"), e.isPublishingTencentCDN_ = !1, n()) : (Kd.error("stopPublishTencentCDN failed, errCode: ".concat(o, " errMsg: ").concat(s)), r(new Error(s)))
                            };
                        e.signalChannel_.once(qp.STOP_PUBLISH_TENCENT_CDN_RES, a), e.signalChannel_.send(uf, t)
                    }))
                }
            }, {
                key: "startPublishGivenCDN",
                value: function (e) {
                    var t = this,
                        n = {
                            roomid: String(this.client_.getRoomId()),
                            sdkAppID: String(this.client_.getSDKAppId()),
                            socketid: this.signalChannel_.getSocketId(),
                            pushRequestTime: Date.now(),
                            pushAppid: e.appId,
                            pushBizId: e.bizId,
                            pushCdnUrl: e.url,
                            pushStreamType: "main"
                        };
                    return Kd.info("startPublishGivenCDN: " + JSON.stringify(n)), this.publishGivenCDNData_ = n, new Promise((function (e, r) {
                        t.isPublishingGivenCDN_ = !0;
                        var i = setTimeout((function () {
                                Kd.error("startPublishGivenCDN timeout observed"), t.isPublishingGivenCDN_ = !1, t.signalChannel_.off(qp.START_PUBLISH_GIVEN_CDN_RES, a), r(new Error("startPublishGivenCDN timeout"))
                            }), 5e3),
                            a = function (n) {
                                clearTimeout(i);
                                var a = n.data.content,
                                    o = a.errCode,
                                    s = a.errMsg;
                                0 === o ? e() : (Kd.error("startPublishGivenCDN failed, errCode: ".concat(o, ", errMsg: ").concat(s)), t.isPublishingGivenCDN_ = !1, r(new Error(s)))
                            };
                        t.signalChannel_.once(qp.START_PUBLISH_GIVEN_CDN_RES, a), t.signalChannel_.send(df, n)
                    }))
                }
            }, {
                key: "stopPublishGivenCDN",
                value: function () {
                    var e = this,
                        t = this.publishGivenCDNData_,
                        n = t.pushAppid,
                        r = t.pushBizId,
                        i = t.pushCdnUrl,
                        a = t.pushStreamType,
                        o = {
                            roomid: String(this.client_.getRoomId()),
                            sdkAppID: String(this.client_.getSDKAppId()),
                            socketid: this.signalChannel_.getSocketId(),
                            pushRequestTime: Date.now(),
                            pushAppid: n,
                            pushBizId: r,
                            pushCdnUrl: i,
                            pushStreamType: a
                        };
                    return Kd.info("stopPublishGivenCDN: " + JSON.stringify(o)), new Promise((function (t, n) {
                        var r = setTimeout((function () {
                                Kd.error("stopPublishGivenCDN timeout observed"), e.signalChannel_.off(qp.STOP_PUBLISH_GIVEN_CDN_RES, i), n(new Error("stopPublishGivenCDN timeout"))
                            }), 5e3),
                            i = function (i) {
                                clearTimeout(r);
                                var a = i.data.content,
                                    o = a.errCode,
                                    s = a.errMsg;
                                0 === o ? (e.isPublishingGivenCDN_ = !1, t()) : (Kd.error("stopPublishGivenCDN failed, errCode: ".concat(o, " errMsg: ").concat(s)), n(new Error(s)))
                            };
                        e.signalChannel_.once(qp.STOP_PUBLISH_GIVEN_CDN_RES, i), e.signalChannel_.send(lf, o)
                    }))
                }
            }]), e
        }(),
        nS = function () {
            function e(t) {
                a(this, e), this.client_ = t.client, this.durationMap_ = new Map, this.installEvents()
            }
            return s(e, [{
                key: "installEvents",
                value: function () {
                    lg.on(hg.REMOTE_STREAM_SUBSCRIBED, this.handleSubscribed, this), lg.on(hg.REMOTE_STREAM_TRACK_UPDATED, this.handleStreamTrackUpdated, this), lg.on(hg.REMOTE_STREAM_UNSUBSCRIBED, this.handleStreamStopped, this), lg.on(hg.REMOTE_STREAM_REMOVED, this.handleStreamStopped, this)
                }
            }, {
                key: "uninstallEvents",
                value: function () {
                    lg.off(hg.REMOTE_STREAM_SUBSCRIBED, this.handleSubscribed, this), lg.off(hg.REMOTE_STREAM_UPDATED, this.handleStreamTrackUpdated, this), lg.off(hg.REMOTE_STREAM_UNSUBSCRIBED, this.handleStreamStopped, this), lg.off(hg.REMOTE_STREAM_REMOVED, this.handleStreamStopped, this)
                }
            }, {
                key: "handleSubscribed",
                value: function (e) {
                    var t = e.client,
                        n = e.stream;
                    if (t === this.client_) {
                        var r = n.getUserId(),
                            i = n.getType(),
                            a = "".concat(r, "_").concat(i);
                        if (n.hasAudio())
                            if (n.isMainAudioSubscribed) {
                                var o = new Qg,
                                    s = this.durationMap_.get(a);
                                s ? this.isRecording(s.audio) || s.audio.push(o) : this.durationMap_.set(a, {
                                    userId: r,
                                    type: i,
                                    audio: [o],
                                    video: []
                                })
                            } else this.stopDurationItem(a, Fs);
                        if (n.hasVideo())
                            if ("main" === i && n.isMainVideoSubscribed || "auxiliary" === i && n.isAuxVideoSubscribed) {
                                var c = new Qg,
                                    u = this.durationMap_.get(a);
                                u ? this.isRecording(u.video) || u.video.push(c) : this.durationMap_.set(a, {
                                    userId: r,
                                    type: i,
                                    audio: [],
                                    video: [c]
                                })
                            } else this.stopDurationItem(a, js)
                    }
                }
            }, {
                key: "handleStreamStopped",
                value: function (e) {
                    var t = e.client,
                        n = e.stream;
                    if (this.clientHitTest(t)) {
                        var r = n.getUserId(),
                            i = n.getType(),
                            a = "".concat(r, "_").concat(i);
                        this.stopDurationItem(a, Fs), this.stopDurationItem(a, js)
                    }
                }
            }, {
                key: "handleStreamTrackUpdated",
                value: function (e) {
                    var t = e.client,
                        n = e.userId,
                        r = e.tinyId,
                        i = e.kind,
                        a = e.action;
                    if (this.clientHitTest(t) && this.client_.getConnections().has(r)) {
                        var o = i === Bs ? i : "main",
                            s = "".concat(n, "_").concat(o);
                        if (a === Js) {
                            var c = this.client_.getConnections().get(r).getSubscribeState();
                            if (i === Fs && !c.audio || i === js && !c.video || i === Bs && !c.auxiliary) return;
                            var u = new Qg,
                                d = this.durationMap_.get(s);
                            d ? (i !== Fs || this.isRecording(d.audio) || d.audio.push(u), i === Fs || this.isRecording(d.video) || d.video.push(u)) : this.durationMap_.set(s, {
                                userId: n,
                                type: o,
                                audio: i === Fs ? [u] : [],
                                video: i === Fs ? [] : [u]
                            })
                        } else this.stopDurationItem(s, i === Fs ? Fs : js)
                    }
                }
            }, {
                key: "isRecording",
                value: function (e) {
                    return e.findIndex((function (e) {
                        return 0 === e.endTime
                    })) >= 0
                }
            }, {
                key: "stopDurationItem",
                value: function (e, t) {
                    if (this.durationMap_.has(e)) {
                        var n = this.durationMap_.get(e)[t].find((function (e) {
                            return 0 === e.endTime
                        }));
                        n && n.stop()
                    }
                }
            }, {
                key: "clientHitTest",
                value: function (e) {
                    return this.client_ === e
                }
            }, {
                key: "getDuration",
                value: function (e, t) {
                    return this.durationMap_.has(e) ? this.durationMap_.get(e)[t].reduce((function (e, t) {
                        return e + t.getDuration()
                    }), 0) : 0
                }
            }, {
                key: "getDurationMap",
                value: function () {
                    return this.durationMap_
                }
            }, {
                key: "reset",
                value: function () {
                    this.durationMap_.clear()
                }
            }]), e
        }(),
        rS = Bi.f,
        iS = P((function () {
            return !Object.getOwnPropertyNames(1)
        }));
    Et({
        target: "Object",
        stat: !0,
        forced: iS
    }, {
        getOwnPropertyNames: rS
    });
    var aS, oS, sS, cS, uS, dS, lS, hS, pS, fS, mS, _S, vS = new(function () {
            function e() {
                a(this, e), this.prefix_ = "TRTC", this.queue_ = new Map, this.intervalId_ = Tl.setInterval(this.doFlush.bind(this), 2e4), this.checkStorage()
            }
            return s(e, [{
                key: "getRealKey",
                value: function (e) {
                    return "".concat(this.prefix_, "_").concat(e)
                }
            }, {
                key: "checkStorage",
                value: function () {
                    var e = this;
                    zd() && Object.keys(localStorage).filter((function (t) {
                        if (t.startsWith(e.prefix_)) {
                            var n = JSON.parse(localStorage.getItem(t));
                            if (n && n.expiresIn < Date.now()) return !0
                        }
                        return !1
                    })).forEach((function (e) {
                        return localStorage.removeItem(e)
                    }))
                }
            }, {
                key: "doFlush",
                value: function () {
                    if (zd()) try {
                        var e, t = k(this.queue_);
                        try {
                            for (t.s(); !(e = t.n()).done;) {
                                var n = g(e.value, 2),
                                    r = n[0],
                                    i = n[1];
                                localStorage.setItem(r, JSON.stringify(i))
                            }
                        } catch (a) {
                            t.e(a)
                        } finally {
                            t.f()
                        }
                    } catch (GS) {
                        Kd.warn(GS)
                    }
                }
            }, {
                key: "getItem",
                value: function (e) {
                    if (!zd()) return null;
                    try {
                        var t = JSON.parse(localStorage.getItem(this.getRealKey(e)));
                        return t && t.expiresIn >= Date.now() ? t.value : null
                    } catch (GS) {
                        Kd.warn(GS)
                    }
                }
            }, {
                key: "setItem",
                value: function (e, t) {
                    if (zd()) try {
                        var n = {
                            expiresIn: Date.now() + 6048e5,
                            value: t
                        };
                        this.queue_.set(this.getRealKey(e), n)
                    } catch (GS) {
                        Kd.warn(GS)
                    }
                }
            }, {
                key: "deleteItem",
                value: function (e) {
                    if (!zd()) return !1;
                    try {
                        return e = this.getRealKey(e), this.queue_.delete(e), localStorage.removeItem(e), !0
                    } catch (GS) {
                        return Kd.warn(GS), !1
                    }
                }
            }, {
                key: "clear",
                value: function () {
                    if (zd()) try {
                        localStorage.clear()
                    } catch (GS) {
                        Kd.warn(GS)
                    }
                }
            }]), e
        }()),
        gS = {
            unknown: 0,
            wifi: 1,
            "4g": 2,
            "3g": 3,
            "2g": 4,
            wired: 5
        },
        SS = {
            msg_user_info: 0,
            uint32_video_avg_fps: 0,
            uint32_video_width: 0,
            uint32_video_height: 0,
            uint32_video_avg_bitrate: 0,
            uint32_video_block_time: 0,
            uint32_video_play_time: 0,
            uint32_audio_block_time: 0,
            uint32_audio_play_time: 0,
            uint32_audio_play_db: 0,
            uint32_avg_down_loss: 0,
            uint32_stream_type: 0,
            uint32_video_render_first: 0,
            uint32_video_block_count: 0,
            uint32_audio_block_count: 0,
            uint32_audio_bitrate: 0,
            uint32_video_black_screen_subjective: 0,
            uint32_audio_recv_bitrate: 0,
            uint32_video_external_block_time: 0
        },
        yS = function e(t) {
            a(this, e), this.str_identifier = String(t.userId), this.uint64_tinyid = Number(t.tinyId), this.uint32_role = t.role
        },
        TS = function () {
            function e(t) {
                var n = this;
                a(this, e), this.frameWorkType_ = t.frameWorkType || 30, this.client_ = t.client, this.keyPrefix_ = "key_point", this.storageKey_ = "".concat(this.keyPrefix_, "_").concat(this.client_.getUserId()), this.log_ = new dg({
                    id: "kpm|" + this.client_.getUserId(),
                    direction: "local",
                    type: ""
                }), this.upload = $g({
                    retryFunction: this.upload,
                    settings: {
                        timeout: 500,
                        retries: 3
                    },
                    onError: function (e, t) {
                        return t()
                    }
                }), Object.getOwnPropertyNames(this.__proto__).forEach((function (e) {
                    e.startsWith("handle") && Pu(n[e]) && (n[e] = function (e) {
                        var t = e.fn,
                            n = e.context;
                        return i(regeneratorRuntime.mark((function e() {
                            var r, i, a, o = arguments;
                            return regeneratorRuntime.wrap((function (e) {
                                for (;;) switch (e.prev = e.next) {
                                case 0:
                                    for (e.prev = 0, r = o.length, i = new Array(r), a = 0; a < r; a++) i[a] = o[a];
                                    return e.next = 4, t.apply(n || this, i);
                                case 4:
                                    return e.abrupt("return", e.sent);
                                case 7:
                                    e.prev = 7, e.t0 = e.catch(0), Kd.error("".concat(t.name, "() error observed ") + e.t0);
                                case 10:
                                case "end":
                                    return e.stop()
                                }
                            }), e, this, [
                                [0, 7]
                            ])
                        })))
                    }({
                        fn: n[e],
                        context: n
                    }))
                })), this.initData(), this.installEvents(), this.intervalId_ = Tl.setInterval(this.setStorage.bind(this), 2e4)
            }
            var n, r, o;
            return s(e, [{
                key: "initData",
                value: function () {
                    this.firstPublishedUserList_ = [], this.networkQuality_ = {
                        totalUplinkRTT: 0,
                        totalUplinkLoss: 0,
                        count: 0,
                        totalDownlinkRTTAndLossMap: new Map
                    }, this.basicInfo = {
                        string_sdk_version: "4.11.8",
                        uint32_os_type: 15,
                        string_device_name: "",
                        string_http_user_agent: navigator.userAgent,
                        string_os_version: "",
                        uint32_avg_rtt: 0,
                        uint32_avg_up_loss: 0,
                        uint32_scene: "live" === this.client_.getMode() ? 1 : 0,
                        uint32_joining_duration: 0,
                        uint32_networkType: gS[Cu()],
                        uint32_framework: this.frameWorkType_
                    }, this.pathJoinRoom_ = {
                        uint64_start_time: 0,
                        uint64_init_audio_start_time: 0,
                        uint64_init_audio_end_time: 0,
                        uint64_init_camera_start_time: 0,
                        uint64_init_camera_end_time: 0,
                        uint64_send_request_enter_room_cmd_start_time: 0,
                        uint64_send_request_enter_room_cmd_end_time: 0,
                        uint64_send_first_video_frame_time: 0,
                        uint64_recv_userlist_time: 0,
                        uint64_end_time: 0,
                        int32_init_audio_ret: 0,
                        int32_init_camera_ret: 0,
                        int32_send_request_enter_room_cmd_ret: 0,
                        int32_end_ret: 0
                    }, this.pathLeaveRoom_ = {
                        uint64_start_time: 0,
                        uint64_send_request_exit_room_cmd_start_time: 0,
                        uint64_send_request_exit_room_cmd_end_time: 0,
                        uint64_end_time: 0,
                        int32_send_request_exit_room_cmd_ret: 0,
                        int32_end_ret: 0
                    }, this.pathMainVideoMap_ = new Map, this.pathMainAudioMap_ = new Map, this.pathAuxiliaryMap_ = new Map, this.localStreamStats_ = {
                        totalVideoBitrate: 0,
                        totalVideoFPS: 0,
                        totalVideoHeight: 0,
                        totalVideoWidth: 0,
                        totalAudioLevel: 0,
                        videoCount: 0,
                        audioLevelCount: 0,
                        publishStartTime: 0,
                        statsToReport: {
                            uint32_audio_capture_db: 0,
                            uint32_video_big_capture_fps: 0,
                            uint32_video_big_bitrate: 0,
                            uint32_video_big_resolution: 0
                        }
                    }, this.remoteStreamStatsMap_ = new Map
                }
            }, {
                key: "installEvents",
                value: function () {
                    lg.on(hg.JOIN_START, this.handleJoinStart, this), lg.on(hg.JOIN_SEND_CMD, this.handleJoinSendCMD, this), lg.on(hg.JOIN_RECEIVED_CMD_RES, this.handleJoinReceivedCMDResponce, this), lg.on(hg.JOIN_SUCCESS, this.handleJoinSuccess, this), lg.on(hg.JOIN_FAILED, this.handleJoinFailed, this), lg.on(hg.RECEIVED_PUBLISHED_USER_LIST, this.handleReceivedPublishUserList, this), lg.on(hg.CONNECTION_STATE_CHANGED, this.handleConnectionStateChanged, this), lg.on(hg.LEAVE_START, this.handleLeaveStart, this), lg.on(hg.LEAVE_SUCCESS, this.handleLeaveSuccess, this), lg.on(hg.LEAVE_SEND_CMD, this.handleLeaveSendCMD, this), lg.on(hg.CONNECTION_SEND_SUBSCRIBE_CMD, this.handleSendSubscribeCMD, this), lg.on(hg.VIDEO_PLAYING, this.handleVideoPlaying, this), lg.on(hg.AUDIO_PLAYING, this.handleAudioPlaying, this), lg.on(hg.NETWORK_QUALITY, this.handleNetworkQuality, this), lg.on(hg.HEARTBEAT_STATS, this.handleHeartbeatStats, this), lg.on(hg.REMOTE_STREAM_ADDED, this.handleRemoteStreamAdded, this), lg.on(hg.REMOTE_STREAM_SUBSCRIBE_START, this.handleRemoteStreamSubscribeStart, this), lg.on(hg.REMOTE_STREAM_SUBSCRIBED, this.handleRemoteStreamSubscribed, this), lg.on(hg.VIDEO_LOADED_DATA, this.handleVideoLoadedData, this), lg.on(hg.PLAY_STREAM_START, this.handlePlayStream, this), lg.on(hg.PUBLISH_START, this.handlePublishStart, this), lg.on(hg.LOCAL_STREAM_INITIALIZE_START, this.handleLocalStreamInitStart, this), lg.on(hg.LOCAL_STREAM_INITIALIZE_END, this.handleLocalStreamInitEnd, this), lg.on(hg.LOCAL_STREAM_INITIALIZE_FAILED, this.handleLocalStreamInitFailed, this)
                }
            }, {
                key: "uninstallEvents",
                value: function () {
                    lg.off(hg.JOIN_START, this.handleJoinStart, this), lg.off(hg.JOIN_SEND_CMD, this.handleJoinSendCMD, this), lg.off(hg.JOIN_RECEIVED_CMD_RES, this.handleJoinReceivedCMDResponce, this), lg.off(hg.RECEIVED_PUBLISHED_USER_LIST, this.handleReceivedPublishUserList, this), lg.off(hg.CONNECTION_STATE_CHANGED, this.handleConnectionStateChanged, this), lg.off(hg.LEAVE_START, this.handleLeaveStart, this), lg.off(hg.LEAVE_SUCCESS, this.handleLeaveSuccess, this), lg.off(hg.JOIN_FAILED, this.handleJoinFailed, this), lg.off(hg.LEAVE_SEND_CMD, this.handleLeaveSendCMD, this), lg.off(hg.CONNECTION_SEND_SUBSCRIBE_CMD, this.handleSendSubscribeCMD, this), lg.off(hg.VIDEO_LOADED_META_DATA, this.handleVideoPlaying, this), lg.off(hg.AUDIO_LOADED_META_DATA, this.handleAudioPlaying, this), lg.off(hg.NETWORK_QUALITY, this.handleNetworkQuality, this), lg.off(hg.HEARTBEAT_STATS, this.handleHeartbeatStats, this), lg.off(hg.REMOTE_STREAM_ADDED, this.handleRemoteStreamAdded, this), lg.off(hg.REMOTE_STREAM_SUBSCRIBE_START, this.handleRemoteStreamSubscribeStart, this), lg.off(hg.REMOTE_STREAM_SUBSCRIBED, this.handleRemoteStreamSubscribed, this), lg.off(hg.VIDEO_LOADED_DATA, this.handleVideoLoadedData, this), lg.off(hg.PLAY_STREAM_START, this.handlePlayStream, this), lg.off(hg.PUBLISH_START, this.handlePublishStart, this), lg.off(hg.LOCAL_STREAM_INITIALIZE_START, this.handleLocalStreamInitStart, this), lg.off(hg.LOCAL_STREAM_INITIALIZE_END, this.handleLocalStreamInitEnd, this), lg.off(hg.LOCAL_STREAM_INITIALIZE_FAILED, this.handleLocalStreamInitFailed, this)
                }
            }, {
                key: "handleJoinStart",
                value: function (e) {
                    this.hitTest(e.client) && 0 === this.pathJoinRoom_.uint64_start_time && (this.pathJoinRoom_.uint64_start_time = Date.now(), this.checkStorage())
                }
            }, {
                key: "handleJoinSendCMD",
                value: function (e) {
                    this.hitTest(e.client) && 0 === this.pathJoinRoom_.uint64_send_request_enter_room_cmd_start_time && (this.pathJoinRoom_.uint64_send_request_enter_room_cmd_start_time = Date.now())
                }
            }, {
                key: "handleJoinReceivedCMDResponce",
                value: function (e) {
                    this.hitTest(e.client) && 0 === this.pathJoinRoom_.uint64_send_request_enter_room_cmd_end_time && (this.pathJoinRoom_.uint64_send_request_enter_room_cmd_end_time = Date.now(), this.pathJoinRoom_.int32_send_request_enter_room_cmd_ret = e.code, 0 !== e.code && (this.pathJoinRoom_.int32_end_ret = 3))
                }
            }, {
                key: "handleJoinSuccess",
                value: function (e) {
                    this.hitTest(e.client) && 0 === this.pathJoinRoom_.uint64_end_time && (this.pathJoinRoom_.uint64_end_time = Date.now(), this.pathJoinRoom_.int32_end_ret = 0)
                }
            }, {
                key: "handleJoinFailed",
                value: function (e) {
                    var t = e.client,
                        n = e.error;
                    this.hitTest(t) && (this.pathJoinRoom_.uint64_end_time = Date.now(), this.pathJoinRoom_.int32_end_ret = 3, this.pathJoinRoom_.int32_send_request_enter_room_cmd_ret = n instanceof ic ? Number(n.getExtraCode() || n.getCode()) : rc.UNKNOWN, this.prepareReport(), this.report())
                }
            }, {
                key: "handleReceivedPublishUserList",
                value: function (e) {
                    this.hitTest(e.client) && 0 === this.pathJoinRoom_.uint64_recv_userlist_time && (this.pathJoinRoom_.uint64_recv_userlist_time = Date.now(), this.firstPublishedUserList_ = e.data.content.userlist)
                }
            }, {
                key: "handleConnectionStateChanged",
                value: function (e) {
                    var t = e.client,
                        n = e.state,
                        r = e.connection;
                    if (this.hitTest(t) && n === rs) {
                        this.client_.getUplinkConnection() === r && 0 === this.pathJoinRoom_.uint64_send_first_video_frame_time && this.localStreamStats_.publishStartTime > this.pathJoinRoom_.uint64_end_time && this.localStreamStats_.publishStartTime - this.pathJoinRoom_.uint64_end_time <= 100 && (this.pathJoinRoom_.uint64_send_first_video_frame_time = Date.now());
                        var i = this.pathMainVideoMap_.get("".concat(r.getUserId(), "_").concat("main"));
                        i && 0 === i.statsToReport.uint64_pc_connected_time && (i.statsToReport.uint64_pc_connected_time = Date.now())
                    }
                }
            }, {
                key: "handleLeaveStart",
                value: function (e) {
                    this.hitTest(e.client) && (this.pathLeaveRoom_.uint64_start_time = Date.now())
                }
            }, {
                key: "handleLeaveSuccess",
                value: function (e) {
                    this.hitTest(e.client) && 0 === this.pathLeaveRoom_.uint64_end_time && (this.pathLeaveRoom_.uint64_end_time = Date.now(), 0 !== this.pathJoinRoom_.uint64_end_time ? this.basicInfo.uint32_joining_duration = this.pathLeaveRoom_.uint64_end_time - this.pathJoinRoom_.uint64_end_time : this.log_.warn("pathJoinRoom endTime is 0"), this.report())
                }
            }, {
                key: "handleLeaveSendCMD",
                value: function (e) {
                    this.hitTest(e.client) && (this.pathLeaveRoom_.uint64_send_request_exit_room_cmd_start_time = Date.now(), this.pathLeaveRoom_.uint64_send_request_exit_room_cmd_end_time = Date.now())
                }
            }, {
                key: "handleRemoteStreamAdded",
                value: function (e) {
                    var n = e.client,
                        r = e.stream;
                    if (this.hitTest(n)) {
                        var i = r.getUserId(),
                            a = r.getType(),
                            o = "".concat(i, "_").concat(a),
                            s = this.remoteStreamStatsMap_.get(o);
                        if (s) s.stream = r;
                        else {
                            var c = {
                                userId: i,
                                totalVideoFPS: 0,
                                totalVideoBitrate: 0,
                                totalAudioLevel: 0,
                                totalAudioBitrate: 0,
                                totalLoss: 0,
                                audioCount: 0,
                                audioLevelCount: 0,
                                videoCount: 0,
                                networkQualityCount: 0,
                                streamAddedTime: Date.now(),
                                subscribeStartTime: 0,
                                subscribedTime: 0,
                                playStreamTime: 0,
                                statsToReport: t({}, SS),
                                stream: r
                            };
                            c.statsToReport.msg_user_info = new yS({
                                userId: i,
                                tinyId: r.getTinyId(),
                                role: Qo
                            }), c.statsToReport.uint32_stream_type = "main" === a ? 2 : 7, this.remoteStreamStatsMap_.set(o, c)
                        }
                    }
                }
            }, {
                key: "handleRemoteStreamSubscribeStart",
                value: function (e) {
                    var t = e.client,
                        n = e.stream;
                    if (this.hitTest(t)) {
                        var r = n.getUserId(),
                            i = n.getType(),
                            a = "".concat(r, "_").concat(i),
                            o = this.remoteStreamStatsMap_.get(a);
                        o && 0 === o.subscribeStartTime && (o.subscribeStartTime = Date.now())
                    }
                }
            }, {
                key: "handleSendSubscribeCMD",
                value: function (e) {
                    if (this.hitTest(e.client)) {
                        var t = new yS(e),
                            n = Date.now(),
                            r = "".concat(e.userId, "_").concat("main");
                        e.trackState.video && e.subscribeState.video && !this.pathMainVideoMap_.has(r) && this.pathMainVideoMap_.set(r, {
                            statsToReport: {
                                msg_user_info: t,
                                uint64_start_enter_time: this.pathJoinRoom_.uint64_start_time,
                                uint64_render_first_frame_time: 0,
                                uint64_combine_first_frame_time: 0,
                                uint64_pc_connected_time: 0
                            },
                            userId: e.userId,
                            sendSubscribeCMDTime: n
                        }), e.trackState.audio && e.subscribeState.audio && !this.pathMainAudioMap_.has(r) && this.pathMainAudioMap_.set(r, {
                            statsToReport: {
                                msg_user_info: t,
                                uint64_start_enter_time: this.pathJoinRoom_.uint64_start_time,
                                uint64_play_first_frame_time: 0
                            },
                            userId: e.userId,
                            sendSubscribeCMDTime: n
                        });
                        var i = "".concat(e.userId, "_").concat("auxiliary");
                        e.trackState.auxiliary && e.subscribeState.auxiliary && !this.pathAuxiliaryMap_.has(i) && this.pathAuxiliaryMap_.set(i, {
                            sendSubscribeCMDTime: n
                        })
                    }
                }
            }, {
                key: "handleRemoteStreamSubscribed",
                value: function (e) {
                    var t = e.client,
                        n = e.stream;
                    if (this.hitTest(t)) {
                        var r = n.getUserId(),
                            i = n.getType(),
                            a = "".concat(r, "_").concat(i),
                            o = this.remoteStreamStatsMap_.get(a);
                        o && 0 === o.subscribedTime && (o.subscribedTime = Date.now(), o.stream = n)
                    }
                }
            }, {
                key: "handlePlayStream",
                value: function (e) {
                    var t = e.stream;
                    if (t.isRemote() && t.getConnection() && this.hitTest(t.getConnection().getClient())) {
                        var n = t.getConnection().getUserId(),
                            r = "".concat(n, "_").concat(t.getType());
                        if (this.remoteStreamStatsMap_.has(r)) {
                            var i = this.remoteStreamStatsMap_.get(r);
                            0 === i.playStreamTime && (i.playStreamTime = Date.now())
                        }
                    }
                }
            }, {
                key: "handleVideoLoadedData",
                value: function (e) {
                    var t = e.stream;
                    if (t.isRemote() && t.getConnection() && this.hitTest(t.getConnection().getClient())) {
                        var n = t.getConnection().getUserId(),
                            r = "".concat(n, "_").concat(t.getType());
                        if (this.pathMainVideoMap_.has(r)) {
                            var i = this.pathMainVideoMap_.get(r);
                            0 === i.statsToReport.uint64_combine_first_frame_time && (i.statsToReport.uint64_combine_first_frame_time = Date.now())
                        }
                    }
                }
            }, {
                key: "handleVideoPlaying",
                value: function (e) {
                    var t = e.stream;
                    if (t.isRemote() && t.getConnection() && this.hitTest(t.getConnection().getClient())) {
                        var n = t.getConnection().getUserId(),
                            r = "".concat(n, "_").concat(t.getType()),
                            i = Date.now();
                        if (this.pathMainVideoMap_.has(r)) {
                            var a = this.pathMainVideoMap_.get(r);
                            if (0 === a.statsToReport.uint64_render_first_frame_time && (a.statsToReport.uint64_render_first_frame_time = i), this.remoteStreamStatsMap_.has(r)) {
                                var o = this.remoteStreamStatsMap_.get(r),
                                    s = o.statsToReport,
                                    c = o.playStreamTime,
                                    u = o.subscribedTime;
                                0 === s.uint32_video_render_first && c - u <= 100 && (s.uint32_video_render_first = i - a.sendSubscribeCMDTime)
                            }
                        }
                        if ("auxiliary" === t.getType() && this.pathAuxiliaryMap_.has(r) && this.remoteStreamStatsMap_.has(r)) {
                            var d = this.remoteStreamStatsMap_.get(r),
                                l = d.statsToReport,
                                h = d.playStreamTime,
                                p = d.subscribedTime;
                            0 === l.uint32_video_render_first && h - p <= 100 && (l.uint32_video_render_first = i - this.pathAuxiliaryMap_.get(r).sendSubscribeCMDTime)
                        }
                    }
                }
            }, {
                key: "handleAudioPlaying",
                value: function (e) {
                    if (e.stream.isRemote() && e.stream.getConnection() && this.hitTest(e.stream.getConnection().getClient())) {
                        var t = e.stream.getConnection().getUserId(),
                            n = "".concat(t, "_").concat(e.stream.getType());
                        if (this.pathMainAudioMap_.has(n)) {
                            var r = this.pathMainAudioMap_.get(n);
                            0 === r.statsToReport.uint64_play_first_frame_time && (r.statsToReport.uint64_play_first_frame_time = Date.now())
                        }
                    }
                }
            }, {
                key: "handleNetworkQuality",
                value: function (e) {
                    var t = this;
                    this.hitTest(e.client) && (this.networkQuality_.totalUplinkLoss += e.uplinkLoss, this.networkQuality_.totalUplinkRTT += e.uplinkRTT, this.networkQuality_.count++, e.downlinkLossAndRTTMap.forEach((function (e) {
                        var n = e.rtt,
                            r = e.loss,
                            i = e.userId,
                            a = t.networkQuality_.totalDownlinkRTTAndLossMap.get(i);
                        a ? (a.totalRTT += n, a.totalLoss += r, a.count++) : t.networkQuality_.totalDownlinkRTTAndLossMap.set(i, {
                            totalRTT: n,
                            totalLoss: r,
                            count: 1
                        })
                    })))
                }
            }, {
                key: "handleHeartbeatStats",
                value: function (e) {
                    var t = this;
                    if (this.hitTest(e.client)) {
                        var n = e.stats,
                            r = n.VideoReportState,
                            i = n.AudioReportState;
                        r.VideoEncState[0] && (this.localStreamStats_.totalVideoBitrate += r.uint32_video_snd_br, this.localStreamStats_.totalVideoFPS += r.VideoEncState[0].uint32_enc_fps, this.localStreamStats_.totalVideoWidth += r.VideoEncState[0].uint32_enc_width, this.localStreamStats_.totalVideoHeight += r.VideoEncState[0].uint32_enc_height, this.localStreamStats_.videoCount++), r.VideoDecState.forEach((function (e) {
                            var n = 0 === e.uint32_video_strtype,
                                r = 2 === e.uint32_video_strtype,
                                i = "".concat(e.userId, "_").concat(n ? "main" : "auxiliary");
                            if (t.remoteStreamStatsMap_.has(i)) {
                                var a = t.remoteStreamStatsMap_.get(i);
                                (n && a.stream.isMainVideoSubscribed || r && a.stream.isAuxVideoSubscribed) && (a.totalVideoFPS += e.uint32_video_recv_fps, a.totalVideoBitrate += e.uint32_video_recv_br, a.videoCount++, 0 === a.statsToReport.uint32_video_width && (a.statsToReport.uint32_video_width = e.uint32_dec_width), 0 === a.statsToReport.uint32_video_height && (a.statsToReport.uint32_video_height = e.uint32_dec_height))
                            }
                        })), i && (i.AudioDecState.forEach((function (e) {
                            var n = "".concat(e.userId, "_").concat("main");
                            if (t.remoteStreamStatsMap_.has(n)) {
                                var r = t.remoteStreamStatsMap_.get(n);
                                r.stream.isMainAudioSubscribed && (r.totalAudioBitrate += e.uint32_audio_real_recv_br, r.audioCount++, Math.floor(100 * e.audioLevel) > 0 && (r.totalAudioLevel += e.audioLevel, r.audioLevelCount++))
                            }
                        })), Math.floor(100 * i.sentAudioLevel) > 0 && (this.localStreamStats_.totalAudioLevel += i.sentAudioLevel, this.localStreamStats_.audioLevelCount++))
                    }
                }
            }, {
                key: "handlePublishStart",
                value: function (e) {
                    var t = e.client;
                    this.hitTest(t) && 0 === this.localStreamStats_.publishStartTime && (this.localStreamStats_.publishStartTime = Date.now())
                }
            }, {
                key: "handleLocalStreamInitStart",
                value: function (e) {
                    var t = e.audio,
                        n = e.video;
                    t && 0 === this.pathJoinRoom_.uint64_init_audio_start_time && (this.pathJoinRoom_.uint64_init_audio_start_time = Date.now()), n && 0 === this.pathJoinRoom_.uint64_init_camera_start_time && (this.pathJoinRoom_.uint64_init_camera_start_time = Date.now())
                }
            }, {
                key: "handleLocalStreamInitEnd",
                value: function (e) {
                    var t = e.audio,
                        n = e.video;
                    t && 0 === this.pathJoinRoom_.uint64_init_audio_end_time && (this.pathJoinRoom_.uint64_init_audio_end_time = Date.now()), n && 0 === this.pathJoinRoom_.uint64_init_camera_end_time && (this.pathJoinRoom_.uint64_init_camera_end_time = Date.now())
                }
            }, {
                key: "handleLocalStreamInitFailed",
                value: function (e) {
                    var t = e.audio,
                        n = e.video,
                        r = e.error,
                        i = r instanceof ic ? r.getExtraCode() || r.getCode() : {
                            NotFoundError: 1,
                            NotAllowedError: 2,
                            NotReadableError: 3,
                            OverConstrainedError: 4,
                            AbortError: 5
                        }[r.name] || rc.UNKNOWN;
                    t && 0 === this.pathJoinRoom_.uint64_init_audio_end_time && (this.pathJoinRoom_.int32_init_audio_ret = i, this.pathJoinRoom_.uint64_init_audio_end_time = Date.now()), n && 0 === this.pathJoinRoom_.uint64_init_camera_end_time && (this.pathJoinRoom_.int32_init_camera_ret = i, this.pathJoinRoom_.uint64_init_camera_end_time = Date.now())
                }
            }, {
                key: "hasVideoFlag",
                value: function (e) {
                    return this.firstPublishedUserList_.findIndex((function (t) {
                        return t.userid === e && 1 & t.flag
                    })) >= 0
                }
            }, {
                key: "hasAudioFlag",
                value: function (e) {
                    return this.firstPublishedUserList_.findIndex((function (t) {
                        return t.userid === e && 8 & t.flag
                    })) >= 0
                }
            }, {
                key: "hasAuxFlag",
                value: function (e) {
                    return this.firstPublishedUserList_.findIndex((function (t) {
                        return t.userid === e && 4 & t.flag
                    })) >= 0
                }
            }, {
                key: "hitTest",
                value: function (e) {
                    return e === this.client_
                }
            }, {
                key: "checkStorage",
                value: (o = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (e.prev = 0, !(t = vS.getItem(this.storageKey_))) {
                                e.next = 6;
                                break
                            }
                            return e.next = 5, this.upload(t);
                        case 5:
                            vS.deleteItem(this.storageKey_);
                        case 6:
                            e.next = 11;
                            break;
                        case 8:
                            e.prev = 8, e.t0 = e.catch(0), this.log_.warn(e.t0);
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 8]
                    ])
                }))), function () {
                    return o.apply(this, arguments)
                })
            }, {
                key: "setStorage",
                value: function () {
                    this.prepareReport();
                    var e = this.getReportData();
                    0 !== e.msg_path_enter_room.uint64_start_time && vS.setItem(this.storageKey_, e)
                }
            }, {
                key: "prepareReport",
                value: function () {
                    var e = this;
                    if (this.networkQuality_.count > 0 && (this.basicInfo.uint32_avg_rtt = Math.floor(this.networkQuality_.totalUplinkRTT / this.networkQuality_.count), this.basicInfo.uint32_avg_up_loss = Math.floor(this.networkQuality_.totalUplinkLoss / this.networkQuality_.count)), this.localStreamStats_.videoCount > 0) {
                        this.localStreamStats_.statsToReport.uint32_video_big_capture_fps = Math.floor(this.localStreamStats_.totalVideoFPS / this.localStreamStats_.videoCount), this.localStreamStats_.statsToReport.uint32_video_big_bitrate = Math.floor(this.localStreamStats_.totalVideoBitrate / this.localStreamStats_.videoCount);
                        var t = Math.floor(this.localStreamStats_.totalVideoWidth / this.localStreamStats_.videoCount),
                            n = Math.floor(this.localStreamStats_.totalVideoHeight / this.localStreamStats_.videoCount);
                        this.localStreamStats_.statsToReport.uint32_video_big_resolution = t << 16 | n
                    }
                    this.localStreamStats_.audioLevelCount > 0 && (this.localStreamStats_.statsToReport.uint32_audio_capture_db = Math.floor(this.localStreamStats_.totalAudioLevel / this.localStreamStats_.audioLevelCount * 100)), this.remoteStreamStatsMap_.forEach((function (t, n) {
                        var r = t.userId;
                        if (e.networkQuality_.totalDownlinkRTTAndLossMap.has(r)) {
                            var i = e.networkQuality_.totalDownlinkRTTAndLossMap.get(r),
                                a = i.totalLoss,
                                o = i.count;
                            t.statsToReport.uint32_avg_down_loss = Math.floor(a / o)
                        }
                        t.videoCount > 0 && (t.statsToReport.uint32_video_avg_fps = Math.floor(t.totalVideoFPS / t.videoCount), t.statsToReport.uint32_video_avg_bitrate = Math.floor(t.totalVideoBitrate / t.videoCount)), t.audioCount > 0 && (t.statsToReport.uint32_audio_recv_bitrate = t.statsToReport.uint32_audio_bitrate = Math.floor(t.totalAudioBitrate / t.audioCount)), t.audioLevelCount > 0 && (t.statsToReport.uint32_audio_play_db = Math.floor(t.totalAudioLevel / t.audioLevelCount * 100));
                        var s = e.client_.getCallDurationCalculator();
                        s && (t.statsToReport.uint32_audio_play_time = s.getDuration(n, Fs), t.statsToReport.uint32_video_play_time = s.getDuration(n, js)), t.statsToReport.uint32_video_render_first = Math.min(t.statsToReport.uint32_video_render_first, 5e3);
                        var c = e.client_.getBadCaseDetector();
                        if (c) {
                            var u = c.getDataFreezeDuration(n),
                                d = u.dataFreeze,
                                l = u.count,
                                h = c.getRenderFreezeDuration(n).renderFreeze;
                            t.statsToReport.uint32_video_block_count = l, t.statsToReport.uint32_video_block_time = Math.min(d, t.statsToReport.uint32_video_play_time), t.statsToReport.uint32_video_external_block_time = Math.min(h, t.statsToReport.uint32_video_play_time), c.isBlackStream(n) && 0 === t.statsToReport.uint32_video_avg_fps ? t.statsToReport.uint32_video_black_screen_subjective = 1 : t.statsToReport.uint32_video_black_screen_subjective = 0
                        }(0 === t.subscribeStartTime || t.subscribeStartTime - t.streamAddedTime > 100 || 0 === t.playStreamTime) && (e.pathMainAudioMap_.delete(n), e.pathMainVideoMap_.delete(n), t.statsToReport.uint32_video_render_first = 0)
                    })), this.pathMainAudioMap_.forEach((function (t, n) {
                        e.hasAudioFlag(t.userId) ? t.statsToReport.uint64_play_first_frame_time - t.statsToReport.uint64_start_enter_time > 5e3 && (t.statsToReport.uint64_play_first_frame_time = t.statsToReport.uint64_start_enter_time + 5e3) : e.pathMainAudioMap_.delete(n)
                    })), this.pathMainVideoMap_.forEach((function (t, n) {
                        e.hasVideoFlag(t.userId) ? t.statsToReport.uint64_render_first_frame_time - t.statsToReport.uint64_start_enter_time > 5e3 && (t.statsToReport.uint64_render_first_frame_time = t.statsToReport.uint64_start_enter_time + 5e3) : e.pathMainVideoMap_.delete(n)
                    })), this.pathJoinRoom_.uint64_end_time - this.pathJoinRoom_.uint64_start_time > 5e3 && (this.pathJoinRoom_.uint64_end_time = this.pathJoinRoom_.uint64_start_time + 5e3)
                }
            }, {
                key: "getReportData",
                value: function () {
                    var e = this.client_.getSignalInfo();
                    return {
                        uint32_sdk_app_id: Number(this.client_.getSDKAppId()),
                        msg_user_info: new yS({
                            userId: this.client_.getUserId(),
                            tinyId: this.client_.getTinyId(),
                            role: "anchor" === this.client_.getRole() ? Qo : Xo
                        }),
                        msg_basic_info: this.basicInfo,
                        uint32_acc_ip: Uu(e.relayIp),
                        uint32_client_ip: Uu(e.localIp, "small"),
                        uint32_acc_port: 0,
                        uint64_timestamp: Date.now(),
                        uint32_seq: Math.floor(Math.random() * Math.pow(2, 31)),
                        msg_path_enter_room: this.pathJoinRoom_,
                        msg_path_exit_room: this.pathLeaveRoom_,
                        msg_path_recv_video: S(this.pathMainVideoMap_.values()).map((function (e) {
                            return e.statsToReport
                        })),
                        msg_quality_statistics: S(this.remoteStreamStatsMap_.values()).map((function (e) {
                            return e.statsToReport
                        })),
                        str_room_name: String(this.client_.getRoomId()),
                        msg_path_recv_audio: S(this.pathMainAudioMap_.values()).map((function (e) {
                            return e.statsToReport
                        })),
                        uint32_info_client_ip: Uu(e.localIp, "small"),
                        error_code: [],
                        msg_local_statistics: this.localStreamStats_.statsToReport
                    }
                }
            }, {
                key: "report",
                value: (r = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, t = this.getReportData(), e.next = 4, this.upload(t);
                        case 4:
                            vS.deleteItem(this.storageKey_), this.initData(), e.next = 11;
                            break;
                        case 8:
                            e.prev = 8, e.t0 = e.catch(0), this.log_.warn(e.t0);
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 8]
                    ])
                }))), function () {
                    return r.apply(this, arguments)
                })
            }, {
                key: "upload",
                value: (n = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!Jd && 0 !== t.msg_path_enter_room.uint64_start_time) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return");
                        case 2:
                            return n = Math.floor(Math.random() * Math.pow(2, 31)), r = Number(this.client_.getSDKAppId()), i = "".concat("https://yun.tim.qq.com", "/v5/AVQualityReportSvc/C2S?random=").concat(n, "&sdkappid=").concat(r, "&cmdtype=jssdk_new_endreport"), e.next = 7, pu.post(i, JSON.stringify(t));
                        case 7:
                            if ("ok" === (a = e.sent).data) {
                                e.next = 10;
                                break
                            }
                            throw "key point upload failed: ".concat(a.data);
                        case 10:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return n.apply(this, arguments)
                })
            }]), e
        }();

    function kS() {
        return function (e, t, n) {
            var r = n.value,
                a = new Map;
            return n.value = i(regeneratorRuntime.mark((function e() {
                var n, i, o, s, c = arguments;
                return regeneratorRuntime.wrap((function (e) {
                    for (;;) switch (e.prev = e.next) {
                    case 0:
                        if (!a.get(this)) {
                            e.next = 2;
                            break
                        }
                        throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: am,
                                data: {
                                    name: t
                                }
                            })
                        });
                    case 2:
                        for (e.prev = 2, a.set(this, !0), n = c.length, i = new Array(n), o = 0; o < n; o++) i[o] = c[o];
                        return e.next = 7, r.apply(this, i);
                    case 7:
                        return s = e.sent, a.set(this, !1), e.abrupt("return", s);
                    case 12:
                        throw e.prev = 12, e.t0 = e.catch(2), a.set(this, !1), e.t0;
                    case 16:
                    case "end":
                        return e.stop()
                    }
                }), e, this, [
                    [2, 12]
                ])
            }))), n
        }
    }
    var bS = (aS = kS(), oS = Mg(Dg.CLIENT.join), sS = kS(), cS = kS(), uS = Mg(Dg.CLIENT.publish), dS = kS(), lS = Mg(Dg.CLIENT.unpublish), hS = Mg.apply(void 0, S(Dg.CLIENT.subscribe)), pS = Mg(Dg.CLIENT.unsubscribe), fS = kS(), mS = Mg(Dg.CLIENT.switchRole), b((_S = function () {
            function Client(e) {
                var t, n = this;
                if (a(this, Client), this.name_ = $s, this.mode_ = e.mode, this.sdpSemantics_ = "plan-b", Du(e.sdpSemantics) ? function () {
                    if (!Iv()) return !1;
                    if (Du(window.RTCRtpTransceiver)) return !1;
                    if (!("currentDirection" in RTCRtpTransceiver.prototype)) return !1;
                    var e = new RTCPeerConnection,
                        t = !1;
                    try {
                        e.addTransceiver(Fs), t = !0
                    } catch (GS) {}
                    return e.close(), t
                }() && (this.sdpSemantics_ = "unified-plan") : this.sdpSemantics_ = e.sdpSemantics, this.sdkAppId_ = e.sdkAppId, this.userId_ = e.userId, this.log_ = new dg({
                    id: "c".concat(e.seq, "|").concat(this.userId_),
                    direction: "local",
                    type: ""
                }), this.userSig_ = e.userSig, this.roomId_ = 0, this.useStringRoomId_ = e.useStringRoomId || !1, this.recordId_ = null, this.pureAudioPushMode_ = null, this.version_ = e.version, this.log_.info("using sdpSemantics: " + this.sdpSemantics_), Kd.setConfig({
                    sdkAppId: this.sdkAppId_,
                    userId: this.userId_,
                    version: this.version_
                }), !Du(e.recordId)) {
                    if (!Number.isInteger(Number(e.recordId))) throw new ic({
                        code: rc.INVALID_PARAMETER,
                        message: Z_({
                            key: km
                        })
                    });
                    this.recordId_ = e.recordId
                }
                this.signalChannel_ = null, this.isScreenShareOnly_ = 0, Du(e.isScreenShareOnly) || (this.isScreenShareOnly_ = e.isScreenShareOnly ? 1 : 0), this.role_ = "anchor", this.privateMapKey_ = "", this.tinyId_ = 0, this.env_ = "", this.proxy_ = null, this.connections_ = new Map, this.mutedStates_ = new Map, this.userMap_ = new Map, this.syncUserListInterval_ = -1, this.localStream_ = null, this.uplinkConnection_ = null, this.emitter_ = new Vp, this.signalInfo_ = {}, this.isSignalReady_ = !1, this.isJoined_ = !1, this.heartbeat_ = -1, this.lastHeartBeatTime_ = -1, this.stats_ = new ug, this.joinTimeout_ = -1, this.networkQuality_ = null, this.badCaseDetector_ = null, this.autoSubscribe_ = !!Du(e.autoSubscribe) || e.autoSubscribe, this.startJoinTimestamp_ = 0, this.joinedTimestamp_ = 0, this.joinOptions = {}, this.basis_ = {
                    browser: qd().name + "/" + qd().version,
                    os: xv(),
                    displayResolution: Ov(),
                    isScreenShareSupported: bv(),
                    isWebRTCSupported: _v(),
                    isGetUserMediaSupported: Nv(),
                    isWebAudioSupported: Mv(),
                    isWebSocketsSupported: "WebSocket" in window && 2 === window.WebSocket.CLOSING,
                    isWebCodecSupported: (t = {
                        AudioDecoder: !1,
                        AudioEncoder: !1,
                        VideoDecoder: !1,
                        VideoEncoder: !1,
                        ImageDecoder: !1
                    }, Du(window.AudioDecoder) || (t.AudioDecoder = !0), Du(window.AudioEncoder) || (t.AudioEncoder = !0), Du(window.VideoDecoder) || (t.VideoDecoder = !0), Du(window.VideoEncoder) || (t.VideoEncoder = !0), Du(window.ImageDecoder) || (t.ImageDecoder = !0), t),
                    isMediaSessionSupported: "mediaSession" in navigator && !Du(navigator.mediaSession.setActionHandler),
                    isWebTransportSupported: !Du(window.WebTransport)
                }, this.initBussinessInfo_(e), this.publishedCDN_ = !1, this.publishCDNData_ = null, this.mixedMCU_ = !1, this.mixTranscodeData_ = null, this.checkSystemResult_ = null, this.enableAudioVolumeEvaluation_ = !1, this.audioVolumeIntervalId_ = null, this.mixTranscodeManager_ = null, this.publishCDNManager_ = null, this.keyPointManager_ = new TS({
                    client: this,
                    frameWorkType: e.frameWorkType
                }), this.getUserList = $g({
                    retryFunction: this.getUserList,
                    settings: {
                        retries: 3
                    },
                    onError: function (e, t) {
                        return t()
                    }, onRetrying: function (e) {
                        n.log_.info("retrying to get user list [".concat(e, "/3]"))
                    }
                }), this.isPublishing_ = !1, this.isEnableSmallStream_ = !1, this.smallStreamConfig_ = {
                    bitrate: 100,
                    framerate: 15,
                    height: 120,
                    width: 160
                }, this.turnServers_ = [], this.iceTransportPolicy_ = e.iceTransportPolicy, this.schedule_ = {
                    domains: null,
                    iceServers: null,
                    iceTransportPolicy: null
                }
            }
            var e, n, r, o, c, u, d, l, h, p, f, m, _, v, y, T, b, R, E, I, C, w, A, P;
            return s(Client, [{
                key: "initBussinessInfo_",
                value: function (e) {
                    this.bussinessInfo_ = e.bussinessInfo;
                    var t = {};
                    if (xu(e.bussinessInfo) && (t = JSON.parse(e.bussinessInfo)), !Du(e.pureAudioPushMode)) {
                        if (!Number.isInteger(Number(e.pureAudioPushMode))) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: bm
                            })
                        });
                        this.pureAudioPushMode_ = e.pureAudioPushMode, t.Str_uc_params || (t.Str_uc_params = {}), t.Str_uc_params.pure_audio_push_mod = this.pureAudioPushMode_
                    }
                    if (!Du(e.streamId)) {
                        if (!(xu(e.streamId) && String(e.streamId) && String(e.streamId).length <= 64)) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: Rm
                            })
                        });
                        t.Str_uc_params || (t.Str_uc_params = {}), t.Str_uc_params.userdefine_streamid_main = e.streamId
                    }
                    if (!Du(e.userDefineRecordId)) {
                        if (null === e.userDefineRecordId.match(/^[A-Za-z0-9_-]{1,64}$/gi)) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: Em
                            })
                        });
                        t.Str_uc_params || (t.Str_uc_params = {}), t.Str_uc_params.userdefine_record_id = e.userDefineRecordId
                    }
                    if (!Du(e.userDefinePushArgs)) {
                        if (!(xu(e.userDefinePushArgs) && String(e.userDefinePushArgs) && String(e.userDefinePushArgs).length <= 256)) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: Im
                            })
                        });
                        t.Str_uc_params || (t.Str_uc_params = {}), t.Str_uc_params.userdefine_push_args = e.userDefinePushArgs
                    }
                    tm(t) || (this.bussinessInfo_ = JSON.stringify(t))
                }
            }, {
                key: "setProxyServer",
                value: function (e) {
                    if (this.log_.info("set proxy server: ".concat(JSON.stringify(e))), xu(e)) {
                        if (!e.startsWith("wss://")) throw new ic({
                            code: rc.INVALID_PARAMETER,
                            message: Z_({
                                key: Cm
                            })
                        });
                        this.proxy_ = e
                    } else if (wu(e)) {
                        var t = e.websocketProxy,
                            n = e.loggerProxy;
                        t && (this.proxy_ = t), n && Wo(n)
                    }
                }
            }, {
                key: "schedule",
                value: (P = i(regeneratorRuntime.mark((function e(n) {
                    var r;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.next = 2, Fu({
                                userId: this.userId_,
                                sdkAppId: this.sdkAppId_,
                                roomId: n,
                                useStringRoomId: this.useStringRoomId_,
                                version: this.version_,
                                userSig: this.userSig_
                            });
                        case 2:
                            (r = e.sent) && (this.log_.debug("schedule: ".concat(JSON.stringify(r))), this.schedule_ = t(t({}, this.schedule_), r));
                        case 4:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return P.apply(this, arguments)
                })
            }, {
                key: "getSignalChannelUrl",
                value: function () {
                    var e = {
                            mainUrl: Bo,
                            backupUrl: Ho
                        },
                        t = Ru();
                    return t ? e.mainUrl = e.backupUrl = "wss://".concat(t, ".rtc.qq.com") : this.proxy_ ? e.mainUrl = e.backupUrl = this.proxy_ : Array.isArray(this.schedule_.domains) && this.schedule_.domains.length > 0 && (e.mainUrl = e.backupUrl = "wss://".concat(this.schedule_.domains[0]), this.schedule_.domains[1] && (e.backupUrl = "wss://".concat(this.schedule_.domains[1]))), e
                }
            }, {
                key: "getUserId",
                value: function () {
                    return this.userId_
                }
            }, {
                key: "getUserSig",
                value: function () {
                    return this.userSig_
                }
            }, {
                key: "getRole",
                value: function () {
                    return this.role_
                }
            }, {
                key: "getSignalInfo",
                value: function () {
                    return this.signalInfo_
                }
            }, {
                key: "getRoomId",
                value: function () {
                    return this.roomId_
                }
            }, {
                key: "getSDKAppId",
                value: function () {
                    return this.sdkAppId_
                }
            }, {
                key: "getTinyId",
                value: function () {
                    return this.tinyId_
                }
            }, {
                key: "setTurnServer",
                value: function (e) {
                    this.log_.info("set turn server: " + JSON.stringify(e));
                    var t = [];
                    Array.isArray(e) ? e.forEach((function (e) {
                        return t.push(Lu(e))
                    })) : wu(e) && t.push(Lu(e)), this.turnServers_ = t
                }
            }, {
                key: "getIceTransportPolicy",
                value: function () {
                    return this.iceTransportPolicy_ || this.schedule_.iceTransportPolicy || "all"
                }
            }, {
                key: "initialize",
                value: function () {
                    var e = this;
                    return new Promise((function (t, n) {
                        e.log_.info("setup signal channel");
                        var r = e.getSignalChannelUrl(),
                            i = r.mainUrl,
                            a = r.backupUrl;
                        e.signalChannel_ = new ev({
                            sdkAppId: e.sdkAppId_,
                            userId: e.userId_,
                            userSig: e.userSig_,
                            url: i,
                            backupUrl: a,
                            version: e.version_,
                            client: e
                        }), e.networkQuality_ || (e.networkQuality_ = new pg({
                            connections: e.connections_,
                            signalChannel: e.signalChannel_,
                            userId: e.userId_,
                            client: e
                        }), e.networkQuality_.on(tg, (function (t) {
                            e.emitter_.emit(tg, t)
                        }))), e.deviceDetector_ || (e.deviceDetector_ = new fg), e.subscriptionManager_ || (e.subscriptionManager_ = new jg({
                            client: e
                        })), e.badCaseDetector_ || (e.badCaseDetector_ = new Xg({
                            client: e
                        })), e.callDurationCalculator_ || (e.callDurationCalculator_ = new nS({
                            client: e
                        })), e.mixTranscodeManager_ || (e.mixTranscodeManager_ = new eS({
                            client: e,
                            signalChannel: e.signalChannel_
                        })), e.publishCDNManager_ || (e.publishCDNManager_ = new tS({
                            client: e,
                            signalChannel: e.signalChannel_
                        })), e.signalChannel_.on(Up, (function (t) {
                            switch (e.log_.info("SignalChannel state changed from ".concat(t.prevState, " to ").concat(t.state)), t.state) {
                            case Jp:
                                t.prevState === Gp ? (e.log_.warn("signal channel reconnect successfully"), e.syncUserList(), ku({
                                    eventType: bs
                                })) : t.prevState === Hp && ku({
                                    eventType: ks
                                })
                            }
                            e.emitter_.emit(qv, t)
                        })), e.signalChannel_.on(jp, (function (t) {
                            e.isSignalReady_ ? (e.closeUplink(), e.closeConnections(), e.emitter_.emit(rg, t)) : n(t)
                        })), e.signalChannel_.on(qp.CHANNEL_SETUP_FAILED, (function (t) {
                            e.log_.error("signal channel setup failed"), n(t)
                        })), e.signalChannel_.on(qp.CHANNEL_SETUP_SUCCESS, (function (n) {
                            e.signalInfo_ = n.signalInfo, e.tinyId_ = e.signalInfo_.tinyId, e.isSignalReady_ || (e.isSignalReady_ = !0, t())
                        })), e.signalChannel_.on(qp.PEER_JOIN, e.onPeerJoin, e), e.signalChannel_.on(qp.PEER_LEAVE, e.onPeerLeave, e), e.signalChannel_.on(qp.STREAM_ADDED, (function (t) {
                            e.onRemoteStreamAdded(t.data)
                        })), e.signalChannel_.on(qp.STREAM_REMOVED, (function (t) {
                            e.onRemoteStreamRemoved(t.data)
                        })), e.signalChannel_.on(qp.UPDATE_REMOTE_MUTE_STAT, (function (t) {
                            lg.emit(hg.RECEIVED_PUBLISHED_USER_LIST, {
                                client: e,
                                data: t.data
                            }), e.onPublishedUserList(t.data), e.onUpdateRemoteMuteStat(t.data)
                        })), e.signalChannel_.on(qp.CLINET_BANNED, (function (t) {
                            var n = t.data.content,
                                r = n.type;
                            "banned" === n.type ? r = "you got banned by account admin" : "kick" === n.type ? r = "duplicated userId joining the room" : "user_time_out" === n.type && e.log_.warn("last heart beat time: ".concat(e.lastHeartBeatTime_, " interval: ").concat(Date.now() - e.lastHeartBeatTime_)), Su("stat-banned:".concat(n.type)), e.log_.error("user was banned because of [".concat(n.type, "]")), e.reset(), e.onClientBanned(r)
                        })), e.signalChannel_.on(qp.REQUEST_REBUILD_SESSION, (function (t) {
                            e.signalInfo_ = t.signalInfo;
                            var n = [];
                            e.connections_ && n.push(0);
                            var r, i = [],
                                a = k(e.connections_);
                            try {
                                for (a.s(); !(r = a.n()).done;) {
                                    var o = g(r.value, 2),
                                        s = o[0],
                                        c = o[1];
                                    n.push(s);
                                    var u = c.getPeerConnection();
                                    if (u) {
                                        var d = u.remoteDescription;
                                        d && i.push(d.sdp)
                                    }
                                }
                            } catch (h) {
                                a.e(h)
                            } finally {
                                a.f()
                            }
                            var l = {
                                socketid: e.signalInfo_.socketId,
                                tinyid: e.tinyId_,
                                appid: e.sdkAppId_,
                                openid: e.userId_,
                                sessionid: String(e.roomId_),
                                sids: n,
                                relayInfo: e.signalInfo_.relayInnerIp,
                                remotesdp: i,
                                useStrRoomid: !!e.useStringRoomId_ && 1
                            };
                            e.log_.debug("reconnect - rebuild session with data: ".concat(JSON.stringify(l))), e.signalChannel_.send($p, l)
                        })), e.signalChannel_.on(qp.CLIENT_REJOIN, (function () {
                            e.reJoin()
                        })), e.signalChannel_.connect()
                    }))
                }
            }, {
                key: "join",
                value: (A = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a, o;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!this.isJoined_) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: wm
                                })
                            });
                        case 2:
                            return e.next = 4, kv();
                        case 4:
                            if (this.checkSystemResult_ = e.sent, (n = Ru()) || (n = "qcloud", this.proxy_ && (this.proxy_.startsWith(Go) ? n = "trtc" : this.proxy_.startsWith(Jo) && (n = "webrtc"))), this.env_ = n, gu({
                                env: n,
                                sdkAppId: this.sdkAppId_,
                                userId: this.userId_,
                                version: this.version_
                            }), this.uploadTrtcStats(), r = this.checkSystemResult_.detail, i = r.isH264EncodeSupported, a = r.isVp8EncodeSupported, _v() && (i || a)) {
                                e.next = 13;
                                break
                            }
                            throw new ic({
                                code: rc.NOT_SUPPORTED,
                                message: Z_({
                                    key: B_
                                })
                            });
                        case 13:
                            if (this.joinOptions = t, this.startJoinTimestamp_ = Vu(), lg.emit(hg.JOIN_START, {
                                client: this
                            }), $f(this.userId_, {
                                eventId: Lf,
                                eventDesc: "joining room",
                                timestamp: mu(),
                                userId: this.userId_,
                                tinyId: this.tinyId_
                            }), e.prev = 17, this.schedule_.domains) {
                                e.next = 21;
                                break
                            }
                            return e.next = 21, this.schedule(t.roomId);
                        case 21:
                            return e.next = 23, this.initialize(t);
                        case 23:
                            return e.next = 25, this.doJoin(t);
                        case 25:
                            lg.emit(hg.JOIN_SUCCESS, {
                                client: this
                            }), this.joinedTimestamp_ = Vu(), o = this.joinedTimestamp_ - this.startJoinTimestamp_, ku({
                                eventType: as,
                                delta: o
                            }), ku({
                                eventType: is
                            }), e.next = 38;
                            break;
                        case 32:
                            throw e.prev = 32, e.t0 = e.catch(17), lg.emit(hg.JOIN_FAILED, {
                                client: this,
                                error: e.t0
                            }), bu({
                                eventType: is,
                                error: e.t0
                            }), this.reset(), e.t0;
                        case 38:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [17, 32]
                    ])
                }))), function (e) {
                    return A.apply(this, arguments)
                })
            }, {
                key: "uploadTrtcStats",
                value: (w = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i, a, o, s, c, u, d, l, h, p;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, e.next = 3, HS.getMicrophones();
                        case 3:
                            r = e.sent, t = r && r.length, e.next = 9;
                            break;
                        case 7:
                            e.prev = 7, e.t0 = e.catch(0);
                        case 9:
                            return e.prev = 9, e.next = 12, HS.getCameras();
                        case 12:
                            i = e.sent, n = i && i.length, e.next = 18;
                            break;
                        case 16:
                            e.prev = 16, e.t1 = e.catch(9);
                        case 18:
                            a = {
                                microphone: t,
                                camera: n
                            }, o = this.checkSystemResult_.detail, s = o.isH264EncodeSupported, c = o.isVp8EncodeSupported, u = o.isH264DecodeSupported, d = o.isVp8DecodeSupported, l = {
                                webRTC: this.basis_.isWebRTCSupported,
                                getUserMedia: this.basis_.isGetUserMediaSupported,
                                webSocket: this.basis_.isWebSocketsSupported,
                                screenShare: this.basis_.isScreenShareSupported,
                                webAudio: this.basis_.isWebAudioSupported,
                                h264Encode: s,
                                h264Decode: u,
                                vp8Encode: c,
                                vp8Decode: d
                            }, h = {
                                browser: this.basis_.browser,
                                os: this.basis_.os,
                                trtc: l,
                                devices: a
                            }, p = {
                                isWebCodecSupported: this.basis_.isWebCodecSupported,
                                isMediaSessionSupported: this.basis_.isMediaSessionSupported,
                                isWebTransportSupported: this.basis_.isWebTransportSupported
                            }, Su("trtcstats-" + JSON.stringify(h)), this.log_.info("TrtcStats-" + JSON.stringify(h)), Su("trtcadvancedstats-" + JSON.stringify(p));
                        case 26:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 7],
                        [9, 16]
                    ])
                }))), function () {
                    return w.apply(this, arguments)
                })
            }, {
                key: "getVersion",
                value: function () {
                    var e = this.version_.split(".");
                    return 1e3 * parseInt(e[0]) + 100 * parseInt(e[1]) + parseInt(e[2])
                }
            }, {
                key: "doJoin",
                value: function (e) {
                    var t = this;
                    return new Promise((function (n, r) {
                        if (!t.isSignalReady_) throw new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: Pm
                            })
                        });
                        t.roomId_ = e.roomId, Du(e.role) || (t.role_ = e.role);
                        var i = "";
                        Du(e.privateMapKey) || (i = e.privateMapKey), t.privateMapKey_ = i, t.log_.info("Join() => joining room: ".concat(e.roomId, " useStringRoomId: ").concat(t.useStringRoomId_, " mode: ").concat(t.mode_, " role: ").concat(t.role_));
                        var a = t.signalInfo_,
                            o = {
                                openid: a.openId,
                                tinyid: a.tinyId,
                                peerconnectionport: "",
                                useStrRoomid: !!t.useStringRoomId_ && 1,
                                roomid: String(e.roomId),
                                sdkAppID: String(t.sdkAppId_),
                                socketid: a.socketId,
                                userSig: t.userSig_,
                                privMapEncrypt: i,
                                privMap: "",
                                relayip: a.relayInnerIp,
                                dataport: a.dataPort,
                                stunport: a.stunPort,
                                checkSigSeq: a.checkSigSeq,
                                pstnBizType: 0,
                                pstnPhoneNumber: null,
                                recordId: t.recordId_,
                                role: "user",
                                jsSdkVersion: String(t.getVersion()),
                                sdpSemantics: t.sdpSemantics_,
                                browserVersion: Gd,
                                closeLocalMedia: !0,
                                trtcscene: "live" === t.mode_ ? Ko : qo,
                                trtcrole: "anchor" === t.role_ ? Qo : Xo,
                                bussinessInfo: t.bussinessInfo_,
                                isAuxUser: t.isScreenShareOnly_,
                                autoSubscribe: t.autoSubscribe_
                            };
                        t.joinTimeout_ = setTimeout((function () {
                            t.log_.error("join room timeout observed"), r(new ic({
                                code: rc.JOIN_ROOM_FAILED,
                                message: Z_({
                                    key: Dm
                                })
                            }))
                        }), 5e3), lg.emit(hg.JOIN_SEND_CMD, {
                            client: t
                        });
                        var s = {
                                AbilityOption: {
                                    GeneralLimit: {
                                        CPULimit: {
                                            uint32_CPU_num: String(navigator.hardwareConcurrency || 0),
                                            str_CPU_name: String(navigator.platform),
                                            uint32_CPU_maxfreq: String(0),
                                            model: "",
                                            uint32_total_memory: String(0)
                                        },
                                        uint32_terminal_type: String(Qu ? 4 : zu ? 2 : Ju ? 3 : bd ? 12 : kd ? 5 : Rd ? 13 : 1),
                                        uint32_device_type: String(0),
                                        str_os_verion: Qu ? "Android" : zu ? "iPhone" : Ju ? "iPad" : bd ? "Mac" : kd ? "Windows" : Rd ? "Linux" : "unknown",
                                        uint32_link_type: String(1),
                                        str_client_version: "4.11.8",
                                        uint32_net_type: String(Ws[Cu()]),
                                        ua: navigator.userAgent,
                                        version: ""
                                    }
                                }
                            },
                            c = t.getSystemResult().detail,
                            u = c.isH264EncodeSupported,
                            d = c.isVp8EncodeSupported,
                            l = "";
                        u ? l = "H264" : d && (l = "VP8");
                        var h = {
                            EncVideoCodec: l,
                            EncVideoWidth: 0,
                            EncVideoHeight: 0,
                            EncVideoBr: "0",
                            EncVideoFps: 0,
                            EncAudioCodec: "opus",
                            EncAudioFS: 0,
                            EncAudioCh: 0,
                            EncAudioBr: "0"
                        };
                        s.AbilityOption.AVLimit = h, t.signalChannel_.sendWithReport(Qp, o, s), t.signalChannel_.once(qp.JOIN_ROOM_RESULT, (function (e) {
                            clearTimeout(t.joinTimeout_), t.joinTimeout_ = -1;
                            var i = e.data.content.ret;
                            lg.emit(hg.JOIN_RECEIVED_CMD_RES, {
                                client: t,
                                code: i
                            }), i ? (t.log_.error("Join room failed result: " + i + " error: " + e.data.content.error), r(new ic({
                                code: rc.JOIN_ROOM_FAILED,
                                extraCode: i,
                                message: Z_({
                                    key: xm,
                                    data: {
                                        error: e.data.content.error
                                    }
                                })
                            }))) : (t.isJoined_ = !0, t.log_.info("Join room success, start heartbeat"), t.startHeartbeat(), t.badCaseDetector_ && t.badCaseDetector_.start(), t.syncUserList(), t.startSyncUserListInterval(), n())
                        }))
                    }))
                }
            }, {
                key: "connectSignalBeforeReJoin",
                value: function () {
                    var e = this;
                    return new Promise((function (t, n) {
                        e.log_.warn("connectSignalBeforeReJoin() try to connect signal before reJoin"), e.isSignalReady_ = !1, e.signalChannel_.close(), e.signalChannel_.once(qp.CHANNEL_SETUP_SUCCESS, (function (n) {
                            e.log_.warn("connectSignalBeforeReJoin() signal setup successfully"), t()
                        })), e.signalChannel_.once(jp, (function (t) {
                            e.log_.warn("connectSignalBeforeReJoin() signal setup failed"), n(t)
                        })), e.signalChannel_.connect()
                    }))
                }
            }, {
                key: "reJoin",
                value: (C = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.isJoined_) {
                                e.next = 3;
                                break
                            }
                            return this.log_.warn("reJoin() you haven't join room yet, abort reJoin"), e.abrupt("return");
                        case 3:
                            return this.isJoined_ = !1, e.prev = 4, this.log_.warn("reJoin() try to reJoin room: ".concat(this.joinOptions.roomId)), this.subscriptionManager_ && this.subscriptionManager_.markAllStream(), e.next = 9, this.connectSignalBeforeReJoin();
                        case 9:
                            return e.next = 11, this.doJoin(this.joinOptions);
                        case 11:
                            if (this.log_.warn("reJoin() reJoin successfully"), ku({
                                eventType: os
                            }), this.checkConnectionsToReconnect(), e.prev = 14, !this.uplinkConnection_ || !this.localStream_ || this.uplinkConnection_.getIsReconnecting()) {
                                e.next = 18;
                                break
                            }
                            return e.next = 18, this.republish();
                        case 18:
                            e.next = 22;
                            break;
                        case 20:
                            e.prev = 20, e.t0 = e.catch(14);
                        case 22:
                            e.next = 29;
                            break;
                        case 24:
                            e.prev = 24, e.t1 = e.catch(4), this.log_.warn("reJoin() reJoin failed" + e.t1), bu({
                                eventType: os,
                                error: e.t1
                            }), this.emitter_.emit(rg, new ic({
                                code: rc.JOIN_ROOM_FAILED,
                                message: Z_({
                                    key: Om,
                                    data: {
                                        roomId: this.joinOptions.roomId
                                    }
                                })
                            }));
                        case 29:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [4, 24],
                        [14, 20]
                    ])
                }))), function () {
                    return C.apply(this, arguments)
                })
            }, {
                key: "republish",
                value: (I = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, this.log_.warn("republish() try to re-publish localStream"), t = this.localStream_, e.next = 5, this.doUnpublish(t);
                        case 5:
                            return e.next = 7, this.publish(t);
                        case 7:
                            this.log_.warn("republish() re-publish localStream successfully"), e.next = 14;
                            break;
                        case 10:
                            throw e.prev = 10, e.t0 = e.catch(0), this.log_.warn("republish() re-publish localStream failed " + e.t0), e.t0;
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 10]
                    ])
                }))), function () {
                    return I.apply(this, arguments)
                })
            }, {
                key: "leave",
                value: (E = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return lg.emit(hg.LEAVE_START, {
                                client: this
                            }), $f(this.userId_, {
                                eventId: Vf,
                                eventDesc: "leaving room",
                                timestamp: mu(),
                                userId: this.userId_,
                                tinyId: this.tinyId_
                            }), e.prev = 2, e.next = 5, this.doHeartbeat();
                        case 5:
                            e.next = 9;
                            break;
                        case 7:
                            e.prev = 7, e.t0 = e.catch(2);
                        case 9:
                            this.doLeave(), lg.emit(hg.LEAVE_SUCCESS, {
                                client: this
                            }), ku({
                                eventType: ss
                            }), t = Math.floor((Vu() - this.joinedTimestamp_) / 1e3), ku({
                                eventType: cs,
                                delta: t
                            });
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [2, 7]
                    ])
                }))), function () {
                    return E.apply(this, arguments)
                })
            }, {
                key: "doLeave",
                value: function () {
                    this.isJoined_ && (lg.emit(hg.LEAVE_SEND_CMD, {
                        client: this
                    }), this.log_.info("leave() => leaving room"), this.signalChannel_.send(Xp), this.reset())
                }
            }, {
                key: "clearNetworkQuality",
                value: function () {
                    this.networkQuality_ && (this.networkQuality_.stop(), this.networkQuality_ = null)
                }
            }, {
                key: "closeConnections",
                value: function () {
                    var e = this;
                    this.connections_.forEach((function (t) {
                        e.closeDownLink(t.getTinyId())
                    }))
                }
            }, {
                key: "destroy",
                value: function () {
                    if (this.isJoined_) throw this.log_.warn("please call leave() before destroy() client"), new ic({
                        code: rc.INVALID_OPERATION,
                        message: Z_({
                            key: Nm
                        })
                    });
                    this.log_.info("destroying SignalChannel"), this.signalChannel_ && (this.signalChannel_.close(), this.signalChannel_ = null)
                }
            }, {
                key: "reset",
                value: function () {
                    this.keyPointManager_ && this.keyPointManager_.prepareReport(), this.mixTranscodeManager_ && (this.mixTranscodeManager_.stop(), this.mixTranscodeManager_ = null), this.publishCDNManager_ && (this.publishCDNManager_ = null), this.userMap_.clear(), this.stopSyncUserListInterval(), this.stopHeartbeat(), this.closeConnections(), this.mutedStates_.clear(), this.clearNetworkQuality(), this.badCaseDetector_ && this.callDurationCalculator_ && this.uploadAllCallStats(), this.closeUplink(), this.isJoined_ = !1, this.isSignalReady_ = !1, this.destroy()
                }
            }, {
                key: "startSyncUserListInterval",
                value: function () {
                    "live" === this.mode_ && "audience" === this.role_ && -1 === this.syncUserListInterval_ && (this.syncUserListInterval_ = Tl.setInterval(this.syncUserList.bind(this), 1e4))
                }
            }, {
                key: "stopSyncUserListInterval",
                value: function () {
                    Tl.clearInterval(this.syncUserListInterval_), this.syncUserListInterval_ = -1
                }
            }, {
                key: "syncUserList",
                value: (R = i(regeneratorRuntime.mark((function e() {
                    var t, n = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.prev = 0, e.next = 3, this.getUserList();
                        case 3:
                            t = e.sent, 0 !== this.userMap_.size && this.userMap_.forEach((function (e) {
                                t.findIndex((function (t) {
                                    return t.userId === e.userId
                                })) < 0 && (n.log_.info("peer leave detected: ".concat(e.userId)), n.cleanUser({
                                    userId: e.userId,
                                    tinyId: e.tinyId
                                }))
                            })), t.forEach((function (e) {
                                var t = e.userId;
                                n.userMap_.has(t) || t === n.userId_ || (n.userMap_.set(t, e), n.emitter_.emit(Kv, {
                                    userId: t
                                }))
                            })), e.next = 11;
                            break;
                        case 8:
                            e.prev = 8, e.t0 = e.catch(0), this.log_.warn("sync user list failed: " + e.t0);
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [0, 8]
                    ])
                }))), function () {
                    return R.apply(this, arguments)
                })
            }, {
                key: "getUserList",
                value: function () {
                    var e = this;
                    return new Promise((function (t, n) {
                        e.signalChannel_.send(ff), e.signalChannel_.once(qp.USER_LIST_RES, (function (e) {
                            var n = e.data.content.userlist.map((function (e) {
                                var t = e.userid,
                                    n = e.srctinyid,
                                    r = e.role;
                                return new Yg({
                                    userId: t,
                                    tinyId: n,
                                    role: r
                                })
                            }));
                            t(n)
                        })), setTimeout(n, 2e3)
                    }))
                }
            }, {
                key: "publish",
                value: (b = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a, o = this;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return t.setPublishState(Ks), this.isPublishing_ = !0, n = Vu(), lg.emit(hg.PUBLISH_START, {
                                client: this,
                                stream: t
                            }), this.log_.info("publish() => publishing local stream"), r = new Jg({
                                userId: this.userId_,
                                tinyId: this.tinyId_,
                                client: this,
                                isUplink: !0,
                                signalChannel: this.signalChannel_
                            }), t.setConnection(r), r.initialize(), r.on(Bv, (function (e) {
                                var t = e.getCode();
                                t !== rc.ICE_TRANSPORT_ERROR && (t === rc.UPLINK_RECONNECTION_FAILED && o.closeUplink(), o.emitter_.emit(rg, e))
                            })), e.prev = 9, e.next = 12, r.publish(t);
                        case 12:
                            this.localStream_ = e.sent, this.localStream_.getBeautyStatus() && this.log_.info("beauty stream is published successfully"), this.log_.info("local stream is published successfully"), this.isPublishing_ = !1, t.setPublishState(Qs), this.uplinkConnection_ = r, i = Vu(), a = i - n, ku({
                                eventType: us
                            }), ku({
                                eventType: ds,
                                delta: a
                            }), t.hasAudio() && $f(this.userId_, {
                                eventId: gf,
                                eventDesc: "publish audio track",
                                timestamp: mu(),
                                userId: this.userId_,
                                tinyId: this.tinyId_
                            }), t.hasVideo() && $f(this.userId_, {
                                eventId: vf,
                                eventDesc: "publish video track",
                                timestamp: mu(),
                                userId: this.userId_,
                                tinyId: this.tinyId_
                            }), this.networkQuality_ && this.networkQuality_.setUplinkConnection(this.uplinkConnection_), this.deviceDetector_ && this.deviceDetector_.setLocalStream(this.localStream_), lg.emit(hg.LOCAL_STREAM_PUBLISHED, {
                                localStream: this.localStream_
                            }), this.notPublishWithoutH264Supported_ = !1, e.next = 39;
                            break;
                        case 30:
                            throw e.prev = 30, e.t0 = e.catch(9), e.t0 instanceof ic && e.t0.getCode() === rc.NOT_SUPPORTED_H264 && (this.notPublishWithoutH264Supported_ = !0), t.setPublishState(qs), r.close(), this.log_.error("failed to publish stream " + e.t0), this.isPublishing_ = !1, bu({
                                eventType: us,
                                error: e.t0
                            }), e.t0;
                        case 39:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [9, 30]
                    ])
                }))), function (e) {
                    return b.apply(this, arguments)
                })
            }, {
                key: "unpublish",
                value: (T = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return this.log_.info("unpublish() => unpublishing local stream"), e.prev = 1, e.next = 4, this.doUnpublish();
                        case 4:
                            ku({
                                eventType: ls
                            }), e.next = 11;
                            break;
                        case 7:
                            throw e.prev = 7, e.t0 = e.catch(1), bu({
                                eventType: ls,
                                error: e.t0
                            }), e.t0;
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [1, 7]
                    ])
                }))), function () {
                    return T.apply(this, arguments)
                })
            }, {
                key: "doUnpublish",
                value: function () {
                    var e = this;
                    return this.signalChannel_.sendWaitForResponse({
                        command: rf,
                        commandDesc: "unpublish",
                        responseCommand: qp.UNPUBLISH_RESULT
                    }).then((function () {
                        e.closeUplink()
                    })).catch((function () {
                        e.closeUplink()
                    }))
                }
            }, {
                key: "closeUplink",
                value: function () {
                    this.uplinkConnection_ && (this.uplinkConnection_.getIsReconnecting() && this.uplinkConnection_.stopReconnection(), this.uplinkConnection_.close(), this.uplinkConnection_ = null, this.networkQuality_ && this.networkQuality_.setUplinkConnection(null), this.localStream_.hasAudio() && $f(this.userId_, {
                        eventId: yf,
                        eventDesc: "unpublish audio track",
                        timestamp: mu(),
                        userId: this.userId_,
                        tinyId: this.tinyId_
                    }), this.localStream_.hasVideo() && $f(this.userId_, {
                        eventId: Sf,
                        eventDesc: "unpublish video track",
                        timestamp: mu(),
                        userId: this.userId_,
                        tinyId: this.tinyId_
                    }), this.localStream_.setConnection(null), this.localStream_ = null, this.deviceDetector_ && this.deviceDetector_.setLocalStream(null))
                }
            }, {
                key: "closeDownLink",
                value: function (e) {
                    var t = this.connections_.get(e);
                    t && (t.getIsReconnecting() && t.stopReconnection(), this.subscriptionManager_ && this.subscriptionManager_.delete(t.getUserId()), t.close(), this.connections_.delete(e), this.mutedStates_.delete(e))
                }
            }, {
                key: "subscribe",
                value: (y = i(regeneratorRuntime.mark((function e(t, n) {
                    var r, i, a;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return this.log_.info("subscribe() => subscribe to [".concat(t.getUserId(), "] ").concat(t.getType(), " stream with options: ").concat(JSON.stringify(n))), Du(n) && (n = {
                                audio: !0,
                                video: !0
                            }), Du(n.video) && (n.video = !0), Du(n.audio) && (n.audio = !0), e.prev = 4, r = t.getConnection(), lg.emit(hg.REMOTE_STREAM_SUBSCRIBE_START, {
                                client: this,
                                stream: t
                            }), e.next = 9, r.subscribe(t, n);
                        case 9:
                            this.subscriptionManager_ && this.subscriptionManager_.addSubscriptionRecord(t.getUserId(), t, n), this.notSubscribeWithoutH264Supported_ = !1, ku({
                                eventType: hs
                            }), e.next = 22;
                            break;
                        case 14:
                            throw e.prev = 14, e.t0 = e.catch(4), (i = e.t0 instanceof ic ? e.t0.getCode() : rc.UNKNOWN) === rc.NOT_SUPPORTED_H264 && (this.notSubscribeWithoutH264Supported_ = !0), a = new ic({
                                code: i,
                                message: Z_({
                                    key: Bm,
                                    data: {
                                        message: e.t0.message
                                    }
                                })
                            }), bu({
                                eventType: hs,
                                error: a
                            }), this.log_.error(a), a;
                        case 22:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [4, 14]
                    ])
                }))), function (e, t) {
                    return y.apply(this, arguments)
                })
            }, {
                key: "unsubscribe",
                value: (v = i(regeneratorRuntime.mark((function e(t) {
                    var n;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return this.log_.info("unsubscribe() => unsubscribe to [".concat(t.getUserId(), "] ").concat(t.getType(), " stream")), e.prev = 1, n = t.getConnection(), e.next = 5, n.unsubscribe(t);
                        case 5:
                            this.subscriptionManager_ && this.subscriptionManager_.addUnsubscriptionRecord(t.getUserId(), t), lg.emit(hg.REMOTE_STREAM_UNSUBSCRIBED, {
                                client: this,
                                stream: t
                            }), ku({
                                eventType: ps
                            }), e.next = 14;
                            break;
                        case 10:
                            throw e.prev = 10, e.t0 = e.catch(1), bu({
                                eventType: ps,
                                error: e.t0
                            }), e.t0;
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [1, 10]
                    ])
                }))), function (e) {
                    return v.apply(this, arguments)
                })
            }, {
                key: "switchRole",
                value: (_ = i(regeneratorRuntime.mark((function e(t) {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.role_ !== t) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return");
                        case 2:
                            if ("audience" !== t || !this.localStream_) {
                                e.next = 5;
                                break
                            }
                            return e.next = 5, this.unpublish(this.localStream_);
                        case 5:
                            return this.log_.info("switchRole() => switch role to: " + t), e.next = 8, this.doSwitchRole(t);
                        case 8:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return _.apply(this, arguments)
                })
            }, {
                key: "doSwitchRole",
                value: function (e) {
                    var t = this;
                    return new Promise((function (n, r) {
                        var i = {
                            trtcscene: "live" === t.mode_ ? Ko : qo,
                            trtcrole: "anchor" === e ? Qo : Xo
                        };
                        t.log_.info("switchRole signal data: " + JSON.stringify(i));
                        var a = setTimeout((function () {
                                t.log_.error("switchRole timeout observed"), t.signalChannel_.off(qp.SWITCH_ROLE_RES, o), r(new ic({
                                    code: rc.SWITCH_ROLE_FAILED,
                                    message: Z_({
                                        key: Jm
                                    })
                                }))
                            }), 5e3),
                            o = function (i) {
                                clearTimeout(a);
                                var o = i.data.content,
                                    s = o.errCode,
                                    c = o.errMsg;
                                0 === s ? (t.role_ = e, n()) : (t.log_.error("switchRole failed, errCode: ".concat(s, ", errMsg: ").concat(c)), r(new ic({
                                    code: rc.SWITCH_ROLE_FAILED,
                                    message: Z_({
                                        key: zm,
                                        data: {
                                            errMsg: c,
                                            errCode: s
                                        }
                                    })
                                })))
                            };
                        t.signalChannel_.once(qp.SWITCH_ROLE_RES, o), t.signalChannel_.send(mf, i)
                    }))
                }
            }, {
                key: "on",
                value: function (e, t, n) {
                    this.emitter_.on(e, t, n)
                }
            }, {
                key: "off",
                value: function (e, t, n) {
                    "*" === e ? this.emitter_.removeAllListeners() : this.emitter_.off(e, t, n)
                }
            }, {
                key: "getRemoteMutedState",
                value: function () {
                    var e = this,
                        n = [];
                    return this.mutedStates_.forEach((function (r, i, a) {
                        var o = e.connections_.get(i);
                        o && n.push(t({
                            userId: o.getUserId()
                        }, r))
                    })), n
                }
            }, {
                key: "getTransportStats",
                value: (m = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i, a, o, s;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (t = {
                                rtt: 0,
                                downlinksRTT: {}
                            }, !this.uplinkConnection_) {
                                e.next = 6;
                                break
                            }
                            return e.next = 4, this.stats_.getSenderStats(this.uplinkConnection_);
                        case 4:
                            n = e.sent, t.rtt = n.rtt;
                        case 6:
                            r = k(this.connections_), e.prev = 7, r.s();
                        case 9:
                            if ((i = r.n()).done) {
                                e.next = 17;
                                break
                            }
                            return (a = g(i.value, 2))[0], o = a[1], e.next = 13, this.stats_.getReceiverStats(o);
                        case 13:
                            s = e.sent, t.downlinksRTT[s.userId] = s.rtt;
                        case 15:
                            e.next = 9;
                            break;
                        case 17:
                            e.next = 22;
                            break;
                        case 19:
                            e.prev = 19, e.t0 = e.catch(7), r.e(e.t0);
                        case 22:
                            return e.prev = 22, r.f(), e.finish(22);
                        case 25:
                            return e.abrupt("return", t);
                        case 26:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [7, 19, 22, 25]
                    ])
                }))), function () {
                    return m.apply(this, arguments)
                })
            }, {
                key: "getLocalAudioStats",
                value: (f = i(regeneratorRuntime.mark((function e() {
                    var t, n;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if ((t = {})[this.userId_] = {
                                bytesSent: 0,
                                packetsSent: 0
                            }, !this.uplinkConnection_) {
                                e.next = 7;
                                break
                            }
                            return e.next = 5, this.stats_.getSenderStats(this.uplinkConnection_);
                        case 5:
                            n = e.sent, t[this.userId_] = {
                                bytesSent: n.audio.bytesSent,
                                packetsSent: n.audio.packetsSent
                            };
                        case 7:
                            return e.abrupt("return", t);
                        case 8:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return f.apply(this, arguments)
                })
            }, {
                key: "getLocalVideoStats",
                value: (p = i(regeneratorRuntime.mark((function e() {
                    var t, n;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if ((t = {})[this.userId_] = {
                                bytesSent: 0,
                                packetsSent: 0,
                                framesEncoded: 0,
                                framesSent: 0,
                                frameWidth: 0,
                                frameHeight: 0
                            }, !this.uplinkConnection_) {
                                e.next = 7;
                                break
                            }
                            return e.next = 5, this.stats_.getSenderStats(this.uplinkConnection_);
                        case 5:
                            n = e.sent, t[this.userId_] = {
                                bytesSent: n.video.bytesSent,
                                packetsSent: n.video.packetsSent,
                                framesEncoded: n.video.framesEncoded,
                                framesSent: n.video.framesSent,
                                frameWidth: n.video.frameWidth,
                                frameHeight: n.video.frameHeight
                            };
                        case 7:
                            return e.abrupt("return", t);
                        case 8:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return p.apply(this, arguments)
                })
            }, {
                key: "getRemoteAudioStats",
                value: (h = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i, a, o;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            t = {}, n = k(this.connections_), e.prev = 2, n.s();
                        case 4:
                            if ((r = n.n()).done) {
                                e.next = 12;
                                break
                            }
                            return (i = g(r.value, 2))[0], a = i[1], e.next = 8, this.stats_.getReceiverStats(a);
                        case 8:
                            (o = e.sent).hasAudio && (t[o.userId] = {
                                bytesReceived: o.audio.bytesReceived,
                                packetsReceived: o.audio.packetsReceived,
                                packetsLost: o.audio.packetsLost
                            });
                        case 10:
                            e.next = 4;
                            break;
                        case 12:
                            e.next = 17;
                            break;
                        case 14:
                            e.prev = 14, e.t0 = e.catch(2), n.e(e.t0);
                        case 17:
                            return e.prev = 17, n.f(), e.finish(17);
                        case 20:
                            return e.abrupt("return", t);
                        case 21:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [2, 14, 17, 20]
                    ])
                }))), function () {
                    return h.apply(this, arguments)
                })
            }, {
                key: "getRemoteVideoStats",
                value: (l = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i, a, o, s, c = arguments;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            t = c.length > 0 && void 0 !== c[0] ? c[0] : "main", n = {}, r = k(this.connections_), e.prev = 3, r.s();
                        case 5:
                            if ((i = r.n()).done) {
                                e.next = 14;
                                break
                            }
                            return (a = g(i.value, 2))[0], o = a[1], e.next = 9, this.stats_.getReceiverStats(o);
                        case 9:
                            s = e.sent, "main" === t && s.hasVideo && (n[s.userId] = {
                                bytesReceived: s.video.bytesReceived,
                                packetsReceived: s.video.packetsReceived,
                                packetsLost: s.video.packetsLost,
                                framesDecoded: s.video.framesDecoded,
                                frameWidth: s.video.frameWidth,
                                frameHeight: s.video.frameHeight
                            }), "auxiliary" === t && s.hasAuxiliary && (n[s.userId] = {
                                bytesReceived: s.auxiliary.bytesReceived,
                                packetsReceived: s.auxiliary.packetsReceived,
                                packetsLost: s.auxiliary.packetsLost,
                                framesDecoded: s.auxiliary.framesDecoded,
                                frameWidth: s.auxiliary.frameWidth,
                                frameHeight: s.auxiliary.frameHeight
                            });
                        case 12:
                            e.next = 5;
                            break;
                        case 14:
                            e.next = 19;
                            break;
                        case 16:
                            e.prev = 16, e.t0 = e.catch(3), r.e(e.t0);
                        case 19:
                            return e.prev = 19, r.f(), e.finish(19);
                        case 22:
                            return e.abrupt("return", n);
                        case 23:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [3, 16, 19, 22]
                    ])
                }))), function () {
                    return l.apply(this, arguments)
                })
            }, {
                key: "getSdpSemantics",
                value: function () {
                    return this.sdpSemantics_
                }
            }, {
                key: "getIceServers",
                value: function () {
                    return 0 === this.turnServers_.length && this.schedule_.iceServers ? this.schedule_.iceServers : this.turnServers_
                }
            }, {
                key: "getConnections",
                value: function () {
                    return this.connections_
                }
            }, {
                key: "getMutedStates",
                value: function () {
                    return this.mutedStates_
                }
            }, {
                key: "startHeartbeat",
                value: function () {
                    if (-1 === this.heartbeat_) {
                        this.log_.info("startHeartbeat..."), this.heartbeat_ = Tl.setInterval(this.doHeartbeat.bind(this), 2e3)
                    }
                }
            }, {
                key: "stopHeartbeat",
                value: function () {
                    -1 !== this.heartbeat_ && (this.log_.info("stopHeartbeat"), Tl.clearInterval(this.heartbeat_), this.heartbeat_ = -1, this.lastHeartBeatTime_ = -1)
                }
            }, {
                key: "doHeartbeat",
                value: (d = i(regeneratorRuntime.mark((function e() {
                    var t, n, r, i, a, o, s;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return t = this.badCaseDetector_.getMonitorFreeze(), e.next = 3, this.stats_.getStatsReport({
                                uplinkConnection: this.uplinkConnection_,
                                downlinkConnections: this.connections_,
                                freezeMap: t
                            });
                        case 3:
                            if (n = e.sent, lg.emit(hg.HEARTBEAT_STATS, {
                                client: this,
                                stats: n
                            }), this.badCaseDetector_.resetMonitor(), this.signalChannel_) {
                                e.next = 8;
                                break
                            }
                            return e.abrupt("return");
                        case 8:
                            r = this.signalChannel_.isConnected() ? Zf(this.userId_) : [], i = {
                                WebRTCQualityReq: n,
                                eventList: r,
                                sdkAppId: this.sdkAppId_,
                                tinyid: this.tinyId_,
                                roomid: this.roomId_,
                                socketid: this.signalInfo_.socketId,
                                clientip: this.signalInfo_.localIp,
                                serverip: this.signalInfo_.relayIp,
                                cpunumber: navigator.hardwareConcurrency || 0,
                                cpudevice: navigator.platform,
                                devicename: navigator.platform,
                                ostype: navigator.platform,
                                mode: this.localStream_ ? this.localStream_.getScreen() ? "screen" : js : ""
                            }, a = 0, this.localStream_ && this.localStream_.getMediaStream() && (o = this.localStream_.getMediaStream().getAudioTracks(), a = o.length > 0 && o[0].muted ? 3 : 1), i.WebRTCQualityReq.AudioReportState.uint32_microphone_status = a, this.signalChannel_.send(Yp, i), s = Date.now(), this.lastHeartBeatTime_ > 0 && s - this.lastHeartBeatTime_ > 1e4 && this.log_.warn("heartbeat took ".concat(s - this.lastHeartBeatTime_)), this.lastHeartBeatTime_ = s;
                        case 17:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return d.apply(this, arguments)
                })
            }, {
                key: "onRemoteStreamAdded",
                value: function (e) {
                    var t = e.content,
                        n = t.srcopenid,
                        r = t.srctinyid;
                    if (null !== n) {
                        this.userMap_.has(n) || (this.userMap_.set(n, new Yg({
                            userId: n,
                            tinyId: r,
                            role: "anchor"
                        })), this.emitter_.emit(Kv, {
                            userId: n
                        }));
                        var i = this.connections_.get(r);
                        if (i) {
                            if (i.getIsReconnecting()) return;
                            this.log_.warn("duplicated stream-added observed, rebuild the connection"), i.close(), this.connections_.delete(r)
                        }
                        var a = {
                            audio: t.audio,
                            video: t.bigVideo,
                            auxiliary: t.auxVideo
                        };
                        this.log_.info("remote peer [".concat(n, "] published stream. trackState: ").concat(JSON.stringify(a))), this.createDownlinkConnection({
                            userId: n,
                            tinyId: r,
                            trackState: a
                        })
                    } else this.log_.warn("received null userId on stream added")
                }
            }, {
                key: "createDownlinkConnection",
                value: function (e) {
                    var t = e.userId,
                        n = e.tinyId,
                        r = e.trackState,
                        i = new zg({
                            userId: t,
                            tinyId: n,
                            client: this,
                            isUplink: !1,
                            signalChannel: this.signalChannel_,
                            autoSubscribe: this.autoSubscribe_,
                            trackState: r
                        });
                    if (this.connections_.set(n, i), this.installDownlinkEvents(i, t, n), this.autoSubscribe_) i.initialize(), i.connect().catch((function () {}));
                    else {
                        if (r.audio || r.video) {
                            var a = new Fg({
                                type: "main",
                                userId: t,
                                client: this
                            });
                            a.setConnection(i), i.setRemoteStream(Yo, a), a.setIsStreamAddedEventEmitted(!0), lg.emit(hg.REMOTE_STREAM_ADDED, {
                                client: this,
                                stream: a
                            }), this.emitter_.emit(Gv, {
                                stream: a
                            })
                        }
                        if (r.auxiliary) {
                            var o = new Fg({
                                type: "auxiliary",
                                userId: t,
                                client: this
                            });
                            o.setConnection(i), i.setRemoteStream($o, o), o.setIsStreamAddedEventEmitted(!0), lg.emit(hg.REMOTE_STREAM_ADDED, {
                                client: this,
                                stream: o
                            }), this.emitter_.emit(Gv, {
                                stream: o
                            })
                        }
                    }
                }
            }, {
                key: "installDownlinkEvents",
                value: function (e, t, n) {
                    var r = this;
                    e.on(Vv, (function (e) {
                        e.stream.setIsStreamAddedEventEmitted(!0), lg.emit(hg.REMOTE_STREAM_ADDED, {
                            client: r,
                            stream: e.stream
                        }), r.emitter_.emit(Gv, {
                            stream: e.stream
                        })
                    })), e.on(Uv, (function (e) {
                        e.stream.stop(), e.stream.setIsStreamAddedEventEmitted(!1), r.subscriptionManager_ && r.subscriptionManager_.deleteAutoRecoveryFlag(e.stream.getUserId(), e.stream.getType()), lg.emit(hg.REMOTE_STREAM_REMOVED, {
                            client: r,
                            stream: e.stream
                        }), r.emitter_.emit(Jv, {
                            stream: e.stream
                        })
                    })), e.on(Fv, (function (e) {
                        lg.emit(hg.REMOTE_STREAM_UPDATED, {
                            client: r,
                            stream: e.stream
                        }), r.emitter_.emit(zv, {
                            stream: e.stream
                        })
                    })), e.on(jv, (function (e) {
                        lg.emit(hg.REMOTE_STREAM_SUBSCRIBED, {
                            client: r,
                            stream: e.stream
                        }), r.emitter_.emit(Wv, {
                            stream: e.stream
                        })
                    })), e.on(Bv, (function (e) {
                        var t = e.getCode();
                        t !== rc.ICE_TRANSPORT_ERROR && (t === rc.DOWNLINK_RECONNECTION_FAILED && r.closeDownLink(n), r.emitter_.emit(rg, e))
                    }))
                }
            }, {
                key: "onRemoteStreamRemoved",
                value: function (e) {
                    var t = e.content,
                        n = t.srctinyid,
                        r = t.srcopenid,
                        i = this.connections_.get(n);
                    i && (void 0 === r && (r = i.getUserId()), this.log_.info("remote peer [".concat(r, "] unpublished stream")), this.closeDownLink(n))
                }
            }, {
                key: "onPeerJoin",
                value: function (e) {
                    var t = e.data.content,
                        n = t.srctinyid,
                        r = t.userid,
                        i = t.role;
                    this.userMap_.has(r) || (this.userMap_.set(r, new Yg({
                        userId: r,
                        tinyId: n,
                        role: i
                    })), this.emitter_.emit(Kv, {
                        userId: r
                    }))
                }
            }, {
                key: "onPeerLeave",
                value: function (e) {
                    var t = e.data.content,
                        n = t.srctinyid,
                        r = t.userid;
                    this.log_.info("peer leave [".concat(r, "]")), this.cleanUser({
                        userId: r,
                        tinyId: n
                    })
                }
            }, {
                key: "cleanUser",
                value: function (e) {
                    var t = e.userId,
                        n = e.tinyId;
                    this.userMap_.delete(t), this.closeDownLink(n), this.emitter_.emit(Qv, {
                        userId: t
                    })
                }
            }, {
                key: "onPublishedUserList",
                value: function (e) {
                    var t = this;
                    try {
                        var n = e.content.userlist.map((function (e) {
                            return e.userid
                        }));
                        this.connections_.forEach((function (e) {
                            var r = e.getUserId(),
                                i = e.getTinyId();
                            n.findIndex((function (e) {
                                return e === r
                            })) < 0 && (t.log_.info("peer unpublished detected [".concat(r, "]")), t.closeDownLink(i))
                        })), e.content.userlist.forEach((function (e) {
                            var n = e.userid,
                                r = e.srctinyid,
                                i = e.flag;
                            if (n !== t.userId_) {
                                var a = !!(1 & i),
                                    o = !!(8 & i),
                                    s = !!(4 & i);
                                if (t.connections_.has(r)) {
                                    var c = t.connections_.get(r).getTrackState(),
                                        u = c.audio,
                                        d = c.video,
                                        l = c.auxiliary;
                                    !d && a && lg.emit(hg.REMOTE_STREAM_TRACK_UPDATED, {
                                        client: t,
                                        tinyId: r,
                                        userId: n,
                                        action: Js,
                                        kind: js
                                    }), !u && o && lg.emit(hg.REMOTE_STREAM_TRACK_UPDATED, {
                                        client: t,
                                        tinyId: r,
                                        userId: n,
                                        action: Js,
                                        kind: Fs
                                    }), !l && s && lg.emit(hg.REMOTE_STREAM_TRACK_UPDATED, {
                                        client: t,
                                        tinyId: r,
                                        userId: n,
                                        action: Js,
                                        kind: Bs
                                    }), d && !a && lg.emit(hg.REMOTE_STREAM_TRACK_UPDATED, {
                                        client: t,
                                        tinyId: r,
                                        userId: n,
                                        action: zs,
                                        kind: js
                                    }), u && !o && lg.emit(hg.REMOTE_STREAM_TRACK_UPDATED, {
                                        client: t,
                                        tinyId: r,
                                        userId: n,
                                        action: zs,
                                        kind: Fs
                                    }), l && !s && lg.emit(hg.REMOTE_STREAM_TRACK_UPDATED, {
                                        client: t,
                                        tinyId: r,
                                        userId: n,
                                        action: zs,
                                        kind: Bs
                                    })
                                } else t.log_.info("peer published detected [".concat(n, "]")), t.onRemoteStreamAdded({
                                    content: {
                                        audio: o,
                                        auxVideo: s,
                                        bigVideo: a,
                                        srcopenid: n,
                                        srctinyid: r
                                    }
                                })
                            }
                        }))
                    } catch (GS) {}
                }
            }, {
                key: "onUpdateRemoteMuteStat",
                value: function (e) {
                    var t = this;
                    e.content.userlist.forEach((function (e) {
                        var n = e.srctinyid,
                            r = e.userid;
                        if (0 !== n && n !== t.tinyId_) {
                            var i = t.connections_.get(n);
                            if (i) {
                                var a = i.getMainStream();
                                if (a && a.getIsStreamAddedEventEmitted()) {
                                    var o = !!(1 & e.flag),
                                        s = !!(8 & e.flag),
                                        c = !!(2 & e.flag),
                                        u = !!(64 & e.flag),
                                        d = !!(16 & e.flag),
                                        l = t.mutedStates_.get(n);
                                    if (void 0 === l) return t.mutedStates_.set(n, {
                                        hasAudio: s,
                                        hasVideo: o,
                                        hasSmall: c,
                                        audioMuted: u,
                                        videoMuted: d
                                    }), o ? d ? t.emitter_.emit(Yv, {
                                        userId: r
                                    }) : t.emitter_.emit(Zv, {
                                        userId: r
                                    }) : t.emitter_.emit(Yv, {
                                        userId: r
                                    }), void(s ? u ? t.emitter_.emit(Xv, {
                                        userId: r
                                    }) : t.emitter_.emit($v, {
                                        userId: r
                                    }) : t.emitter_.emit(Xv, {
                                        userId: r
                                    }));
                                    var h = !u && s;
                                    (!l.audioMuted && l.hasAudio) !== h && (h ? t.emitter_.emit($v, {
                                        userId: r
                                    }) : t.emitter_.emit(Xv, {
                                        userId: r
                                    }));
                                    var p = !d && o;
                                    (!l.videoMuted && l.hasVideo) !== p && (p ? t.emitter_.emit(Zv, {
                                        userId: r
                                    }) : t.emitter_.emit(Yv, {
                                        userId: r
                                    })), t.mutedStates_.set(n, {
                                        hasAudio: s,
                                        hasVideo: o,
                                        hasSmall: c,
                                        audioMuted: u,
                                        videoMuted: d
                                    })
                                }
                            } else t.mutedStates_.delete(n)
                        }
                    }))
                }
            }, {
                key: "onClientBanned",
                value: function (e) {
                    this.emitter_.emit(eg, new ic({
                        code: rc.CLIENT_BANNED,
                        message: Z_({
                            key: Wm,
                            data: {
                                reason: e
                            }
                        })
                    }))
                }
            }, {
                key: "getEnv",
                value: function () {
                    return this.env_
                }
            }, {
                key: "getSubscriptionManager",
                value: function () {
                    return this.subscriptionManager_
                }
            }, {
                key: "startPublishCDNStream",
                value: (u = i(regeneratorRuntime.mark((function e(t) {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.localStream_) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: qm
                                })
                            });
                        case 2:
                            if (Du(t.streamId) || xu(t.streamId)) {
                                e.next = 4;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_PARAMETER,
                                message: Z_({
                                    key: Qm
                                })
                            });
                        case 4:
                            return this.log_.info("startPublishCDNStream params: ".concat(JSON.stringify(t))), e.prev = 5, e.next = 8, this.publishCDNManager_.startPublishTencentCDN(t.streamId);
                        case 8:
                            if (!(t.appId && t.bizId && t.url)) {
                                e.next = 11;
                                break
                            }
                            return e.next = 11, this.publishCDNManager_.startPublishGivenCDN(t);
                        case 11:
                            e.next = 16;
                            break;
                        case 13:
                            throw e.prev = 13, e.t0 = e.catch(5), new ic({
                                code: rc.START_PUBLISH_CDN_FAILED,
                                message: Z_({
                                    key: Xm,
                                    data: e.t0
                                })
                            });
                        case 16:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [5, 13]
                    ])
                }))), function (e) {
                    return u.apply(this, arguments)
                })
            }, {
                key: "stopPublishCDNStream",
                value: (c = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.publishCDNManager_.getIsPublishingTencentCDN()) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: Km
                                })
                            });
                        case 2:
                            return this.log_.info("stopPublishCDNStream"), e.prev = 3, e.next = 6, this.publishCDNManager_.stopPublishTencentCDN();
                        case 6:
                            if (!this.publishCDNManager_.getIsPublishingGivenCDN()) {
                                e.next = 9;
                                break
                            }
                            return e.next = 9, this.publishCDNManager_.stopPublishGivenCDN();
                        case 9:
                            e.next = 14;
                            break;
                        case 11:
                            throw e.prev = 11, e.t0 = e.catch(3), new ic({
                                code: rc.STOP_PUBLISH_CDN_FAILED,
                                message: Z_({
                                    key: Ym,
                                    data: e.t0
                                })
                            });
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [3, 11]
                    ])
                }))), function () {
                    return c.apply(this, arguments)
                })
            }, {
                key: "startMixTranscode",
                value: (o = i(regeneratorRuntime.mark((function e(t) {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.isJoined_ && this.mixTranscodeManager_) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: $m
                                })
                            });
                        case 2:
                            return Du(t.mode) && (t.mode = Ds.MANUAL), e.prev = 3, this.log_.info("startMixTranscode with config ".concat(JSON.stringify(t))), Su("mix-transcode-mode:".concat(t.mode)), e.next = 8, this.mixTranscodeManager_.startMixTranscode(t);
                        case 8:
                            ku({
                                eventType: Is
                            }), e.next = 15;
                            break;
                        case 11:
                            throw e.prev = 11, e.t0 = e.catch(3), bu({
                                eventType: Is,
                                error: e.t0
                            }), e.t0;
                        case 15:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [3, 11]
                    ])
                }))), function (e) {
                    return o.apply(this, arguments)
                })
            }, {
                key: "stopMixTranscode",
                value: (r = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.isJoined_ && this.mixTranscodeManager_) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: Zm
                                })
                            });
                        case 2:
                            return e.prev = 2, e.next = 5, this.mixTranscodeManager_.stopMixTranscode();
                        case 5:
                            ku({
                                eventType: Cs
                            }), e.next = 12;
                            break;
                        case 8:
                            throw e.prev = 8, e.t0 = e.catch(2), bu({
                                eventType: Cs,
                                error: e.t0
                            }), e.t0;
                        case 12:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [2, 8]
                    ])
                }))), function () {
                    return r.apply(this, arguments)
                })
            }, {
                key: "getSystemResult",
                value: function () {
                    return this.checkSystemResult_
                }
            }, {
                key: "enableAudioVolumeEvaluation",
                value: function () {
                    var e = this,
                        t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 2e3,
                        n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
                    if (!Ou(t)) throw new ic({
                        code: rc.INVALID_PARAMETER,
                        message: Z_({
                            key: e_
                        })
                    });
                    if (this.log_.info("enableAudioVolumeEvaluation with interval: " + t), t <= 0) return this.enableAudioVolumeEvaluation_ = !1, Tl.clearInterval(this.audioVolumeIntervalId_), void(this.audioVolumeIntervalId_ = null);
                    t = Math.floor(Math.max(t, 16)), this.audioVolumeIntervalId_ && (Tl.clearInterval(this.audioVolumeIntervalId_), this.audioVolumeIntervalId_ = null), this.enableAudioVolumeEvaluation_ = !0, this.audioVolumeIntervalId_ = Tl.setInterval((function () {
                        var t = [];
                        if (e.localStream_) {
                            var n = Math.floor(100 * e.localStream_.getAudioLevel());
                            t.push({
                                userId: e.userId_,
                                audioVolume: n,
                                stream: e.localStream_
                            })
                        }
                        e.connections_.forEach((function (e) {
                            var n = e.getSubscribedMainStream();
                            if (n) {
                                var r = Math.floor(100 * n.getAudioLevel());
                                t.push({
                                    userId: e.getUserId(),
                                    audioVolume: r,
                                    stream: n
                                })
                            }
                        })), e.emitter_.emit(ng, {
                            result: t
                        })
                    }), t, n)
                }
            }, {
                key: "uploadAllCallStats",
                value: function () {
                    var e = this;
                    this.callDurationCalculator_.getDurationMap().forEach((function (t, n) {
                        var r = {
                            userId: t.userId,
                            type: t.type,
                            duration: e.callDurationCalculator_.getDuration(n, js),
                            dataFreeze: e.badCaseDetector_.getDataFreezeDuration(n).dataFreeze,
                            renderFreeze: e.badCaseDetector_.getRenderFreezeDuration(n).renderFreeze
                        };
                        Su("callStats-" + JSON.stringify(r))
                    })), this.badCaseDetector_.stop(), this.callDurationCalculator_.reset()
                }
            }, {
                key: "enableSmallStream",
                value: (n = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!this.isPublished() && !this.isPublishing_) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: t_
                                })
                            });
                        case 2:
                            if (!Lv()) {
                                e.next = 7;
                                break
                            }
                            this.setIsEnableSmallStream(!0), this.log_.info("SmallStream successfully enabled"), e.next = 8;
                            break;
                        case 7:
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: r_
                                })
                            });
                        case 8:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return n.apply(this, arguments)
                })
            }, {
                key: "disableSmallStream",
                value: (e = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!this.isPublished() && !this.isPublishing_) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: n_
                                })
                            });
                        case 2:
                            this.setIsEnableSmallStream(!1), this.log_.info("SmallStream successfully disabled");
                        case 4:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function () {
                    return e.apply(this, arguments)
                })
            }, {
                key: "setSmallStreamProfile",
                value: function (e) {
                    var t = this;
                    Object.keys(this.smallStreamConfig_).forEach((function (n) {
                        e[n] && (t.smallStreamConfig_[n] = e[n])
                    })), this.log_.info("setSmallStreamProfile: bitrate=".concat(this.smallStreamConfig_.bitrate, ", framerate=").concat(this.smallStreamConfig_.framerate, ", height=").concat(this.smallStreamConfig_.height, ", width=").concat(this.smallStreamConfig_.width));
                    var n = this.smallStreamConfig_,
                        r = n.width,
                        i = n.height,
                        a = n.bitrate,
                        o = n.framerate;
                    if (r < 0 || i < 0 || a < 0 || o < 0) throw new ic({
                        code: rc.INVALID_PARAMETER,
                        message: Z_({
                            key: i_
                        })
                    })
                }
            }, {
                key: "setRemoteVideoStreamType",
                value: function (e, t) {
                    switch (this.log_.info("setRemoteVideoStreamType: streamType=".concat(e.getType(), ", set ").concat(t)), t) {
                    case "big":
                    case "small":
                        this.changeVideoType(e, t)
                    }
                }
            }, {
                key: "changeVideoType",
                value: function (e, t) {
                    if (!(e instanceof Fg)) throw new ic({
                        code: rc.INVALID_PARAMETER,
                        message: Z_({
                            key: a_
                        })
                    });
                    if (!e.getConnection()) throw new ic({
                        code: rc.INVALID_OPERATION,
                        message: Z_({
                            key: jm
                        })
                    });
                    var n = this.getRemoteMutedState().filter((function (t) {
                        return t.userId === e.getUserId()
                    }))[0];
                    if ("small" === t && n && !n.hasSmall) throw new ic({
                        code: rc.INVALID_OPERATION,
                        message: Z_({
                            key: o_
                        })
                    });
                    this.log_.info("change video type: streamType=".concat(e.getType(), ", set ").concat(t));
                    var r = e.getConnection().getTinyId(),
                        i = 1;
                    "big" === t && (i = 0), this.signalChannel_.send(_f, {
                        type: i,
                        srctinyid: r
                    })
                }
            }, {
                key: "setIsEnableSmallStream",
                value: function (e) {
                    this.isEnableSmallStream_ = e
                }
            }, {
                key: "getIsEnableSmallStream",
                value: function () {
                    return this.isEnableSmallStream_
                }
            }, {
                key: "smallStreamConfig",
                get: function () {
                    return this.smallStreamConfig_
                }
            }, {
                key: "isPublished",
                value: function () {
                    return !!this.localStream_
                }
            }, {
                key: "getUplinkConnection",
                value: function () {
                    return this.uplinkConnection_
                }
            }, {
                key: "getLocalStream",
                value: function () {
                    return this.localStream_
                }
            }, {
                key: "getMode",
                value: function () {
                    return this.mode_
                }
            }, {
                key: "getBadCaseDetector",
                value: function () {
                    return this.badCaseDetector_
                }
            }, {
                key: "getCallDurationCalculator",
                value: function () {
                    return this.callDurationCalculator_
                }
            }, {
                key: "getAllConnections",
                value: function () {
                    var e = S(this.connections_.values());
                    return this.uplinkConnection_ && e.push(this.uplinkConnection_), e
                }
            }, {
                key: "isRelayMaybeFailed",
                value: function () {
                    var e = this.getAllConnections();
                    if (0 === e.length) return !1;
                    for (var t = 0; t < e.length; t++)
                        if (e[t].getReconnectionCount() < 6) return !1;
                    return !0
                }
            }, {
                key: "getUseStringRoomId",
                value: function () {
                    return this.useStringRoomId_
                }
            }, {
                key: "checkConnectionsToReconnect",
                value: function () {
                    var e = this;
                    this.getAllConnections().forEach((function (t) {
                        if (!t.getIsReconnecting()) {
                            var n = t.getPeerConnection();
                            n && "closed" === n.connectionState && (e.log_.warn("[".concat(t.getUserId(), "] pc is closed but not reconnect")), t.startReconnection())
                        }
                    }))
                }
            }]), Client
        }()).prototype, "join", [aS, oS], Object.getOwnPropertyDescriptor(_S.prototype, "join"), _S.prototype), b(_S.prototype, "leave", [sS], Object.getOwnPropertyDescriptor(_S.prototype, "leave"), _S.prototype), b(_S.prototype, "publish", [cS, uS], Object.getOwnPropertyDescriptor(_S.prototype, "publish"), _S.prototype), b(_S.prototype, "unpublish", [dS, lS], Object.getOwnPropertyDescriptor(_S.prototype, "unpublish"), _S.prototype), b(_S.prototype, "subscribe", [hS], Object.getOwnPropertyDescriptor(_S.prototype, "subscribe"), _S.prototype), b(_S.prototype, "unsubscribe", [pS], Object.getOwnPropertyDescriptor(_S.prototype, "unsubscribe"), _S.prototype), b(_S.prototype, "switchRole", [fS, mS], Object.getOwnPropertyDescriptor(_S.prototype, "switchRole"), _S.prototype), _S),
        RS = $g({
            retryFunction: function () {
                var e = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!wv()) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return");
                        case 2:
                            return e.next = 4, ES(t);
                        case 4:
                            if (n = e.sent, Kd.info("getUserMedia with constraints: " + JSON.stringify(n)), !n.audio) {
                                e.next = 13;
                                break
                            }
                            return e.next = 9, HS.getMicrophones();
                        case 9:
                            if (r = e.sent, Kd.info("microphones: ".concat(JSON.stringify(r))), 0 !== r.length) {
                                e.next = 13;
                                break
                            }
                            throw new ic({
                                code: rc.DEVICE_NOT_FOUND,
                                message: Z_({
                                    key: K_
                                })
                            });
                        case 13:
                            if (!n.video) {
                                e.next = 20;
                                break
                            }
                            return e.next = 16, HS.getCameras();
                        case 16:
                            if (i = e.sent, Kd.info("cameras: ".concat(JSON.stringify(i))), 0 !== i.length) {
                                e.next = 20;
                                break
                            }
                            throw new ic({
                                code: rc.DEVICE_NOT_FOUND,
                                message: Z_({
                                    key: Q_
                                })
                            });
                        case 20:
                            return e.next = 22, navigator.mediaDevices.getUserMedia(n);
                        case 22:
                            return e.abrupt("return", e.sent);
                        case 23:
                        case "end":
                            return e.stop()
                        }
                    }), e)
                })));
                return function (t) {
                    return e.apply(this, arguments)
                }
            }(),
            settings: {
                retries: 3,
                timeout: 500
            },
            onError: function (e, t, n) {
                "NotReadableError" === e.name ? t() : n(e)
            }, onRetrying: function (e) {
                Kd.warn("getUserMedia NotReadableError observed, retrying [".concat(e, "/3]"))
            }
        });

    function ES(e) {
        return IS.apply(this, arguments)
    }

    function IS() {
        return (IS = i(regeneratorRuntime.mark((function e(n) {
            var r, i, a, o;
            return regeneratorRuntime.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                case 0:
                    if (r = {
                        echoCancellation: n.echoCancellation,
                        autoGainControl: n.autoGainControl,
                        noiseSuppression: n.noiseSuppression
                    }, n.audio) {
                        e.next = 5;
                        break
                    }
                    r = !1, e.next = 15;
                    break;
                case 5:
                    if (tm(n.microphoneId)) {
                        e.next = 9;
                        break
                    }
                    r = t({
                        deviceId: {
                            exact: n.microphoneId
                        },
                        sampleRate: n.sampleRate,
                        channelCount: n.channelCount
                    }, r), e.next = 15;
                    break;
                case 9:
                    return r = t({
                        sampleRate: n.sampleRate,
                        channelCount: n.channelCount
                    }, r), e.next = 12, HS.getMicrophones();
                case 12:
                    i = e.sent, (a = i.filter((function (e) {
                        var t = e.deviceId;
                        return t.length > 0 && "default" !== t
                    }))).length > 0 && (r.deviceId = {
                        exact: a[0].deviceId
                    });
                case 15:
                    return o = {}, o = !Du(n.facingMode) && n.video ? {
                        facingMode: n.facingMode,
                        width: n.width,
                        height: n.height,
                        frameRate: n.frameRate
                    } : !tm(n.cameraId) && n.video ? {
                        deviceId: {
                            exact: n.cameraId
                        },
                        width: n.width,
                        height: n.height,
                        frameRate: n.frameRate
                    } : !!n.video && (!!Du(n.width) || {
                        width: n.width,
                        height: n.height,
                        frameRate: n.frameRate
                    }), e.abrupt("return", {
                        audio: r,
                        video: o
                    });
                case 18:
                case "end":
                    return e.stop()
                }
            }), e)
        })))).apply(this, arguments)
    }
    var CS = function () {
        var e = i(regeneratorRuntime.mark((function e(t) {
            var n, r, i, a, o, s, c, u, d;
            return regeneratorRuntime.wrap((function (e) {
                for (;;) switch (e.prev = e.next) {
                case 0:
                    if (!wv()) {
                        e.next = 2;
                        break
                    }
                    return e.abrupt("return");
                case 2:
                    if (n = null, !(Ud && Fd < 74 || Bd)) {
                        e.next = 27;
                        break
                    }
                    return r = AS(t), Kd.info("getDisplayMedia with constraints: " + JSON.stringify(r)), e.next = 8, navigator.mediaDevices.getDisplayMedia(r);
                case 8:
                    if (i = e.sent, !t.screenAudio) {
                        e.next = 14;
                        break
                    }
                    return Kd.warn("Your browser not support capture system audio"), e.abrupt("return", i);
                case 14:
                    if (!t.audio) {
                        e.next = 24;
                        break
                    }
                    return a = wS(t), Kd.info("getUserMedia with constraints: " + JSON.stringify(a)), e.next = 19, navigator.mediaDevices.getUserMedia(a);
                case 19:
                    return n = e.sent, i.addTrack(n.getAudioTracks()[0]), e.abrupt("return", i);
                case 24:
                    return e.abrupt("return", i);
                case 25:
                    e.next = 53;
                    break;
                case 27:
                    if (!t.screenAudio) {
                        e.next = 37;
                        break
                    }
                    return t.audioConstraints = {
                        echoCancellation: !0,
                        noiseSuppression: !0,
                        sampleRate: 44100
                    }, o = AS(t), Kd.info("getDisplayMedia with constraints: " + JSON.stringify(o)), e.next = 33, navigator.mediaDevices.getDisplayMedia(o);
                case 33:
                    return s = e.sent, e.abrupt("return", s);
                case 37:
                    return c = AS(t), Kd.info("getDisplayMedia with constraints: " + JSON.stringify(c)), e.next = 41, navigator.mediaDevices.getDisplayMedia(c);
                case 41:
                    if (u = e.sent, !t.audio) {
                        e.next = 52;
                        break
                    }
                    return d = wS(t), Kd.info("getUserMedia with constraints: " + JSON.stringify(d)), e.next = 47, navigator.mediaDevices.getUserMedia(d);
                case 47:
                    return n = e.sent, u.addTrack(n.getAudioTracks()[0]), e.abrupt("return", u);
                case 52:
                    return e.abrupt("return", u);
                case 53:
                case "end":
                    return e.stop()
                }
            }), e)
        })));
        return function (t) {
            return e.apply(this, arguments)
        }
    }();

    function wS(e) {
        var t = {
            echoCancellation: e.echoCancellation,
            autoGainControl: e.autoGainControl,
            noiseSuppression: e.noiseSuppression,
            sampleRate: e.sampleRate,
            channelCount: e.channelCount
        };
        return Du(e.microphoneId) || (t.deviceId = {
            exact: e.microphoneId
        }), {
            audio: t,
            video: !1
        }
    }

    function AS(e) {
        var t = {},
            n = {
                width: e.width,
                height: e.height,
                frameRate: e.frameRate
            };
        return Du(e.screenSource) || (n.displaySurface = e.screenSource), t.video = n, Du(e.audioConstraints) || (t.audio = e.audioConstraints), t
    }
    var PS = new Map;
    PS.set("120p", {
        width: 160,
        height: 120,
        frameRate: 15,
        bitrate: 200
    }), PS.set("180p", {
        width: 320,
        height: 180,
        frameRate: 15,
        bitrate: 350
    }), PS.set("240p", {
        width: 320,
        height: 240,
        frameRate: 15,
        bitrate: 400
    }), PS.set("360p", {
        width: 640,
        height: 360,
        frameRate: 15,
        bitrate: 800
    }), PS.set("480p", {
        width: 640,
        height: 480,
        frameRate: 15,
        bitrate: 900
    }), PS.set("720p", {
        width: 1280,
        height: 720,
        frameRate: 15,
        bitrate: 1500
    }), PS.set("1080p", {
        width: 1920,
        height: 1080,
        frameRate: 15,
        bitrate: 2e3
    }), PS.set("1440p", {
        width: 2560,
        height: 1440,
        frameRate: 30,
        bitrate: 4860
    }), PS.set("4K", {
        width: 3840,
        height: 2160,
        frameRate: 30,
        bitrate: 9e3
    });
    var DS = new Map;
    DS.set("480p", {
        width: 640,
        height: 480,
        frameRate: 5,
        bitrate: 900
    }), DS.set("480p_2", {
        width: 640,
        height: 480,
        frameRate: 30,
        bitrate: 1e3
    }), DS.set("720p", {
        width: 1280,
        height: 720,
        frameRate: 5,
        bitrate: 1200
    }), DS.set("720p_2", {
        width: 1280,
        height: 720,
        frameRate: 30,
        bitrate: 3e3
    }), DS.set("1080p", {
        width: 1920,
        height: 1080,
        frameRate: 5,
        bitrate: 1600
    }), DS.set("1080p_2", {
        width: 1920,
        height: 1080,
        frameRate: 30,
        bitrate: 4e3
    });
    var xS, OS, NS = new Map;
    NS.set("standard", {
        sampleRate: 48e3,
        channelCount: 1,
        bitrate: 40
    }), NS.set("standard-stereo", {
        sampleRate: 48e3,
        channelCount: 2,
        bitrate: 64
    }), NS.set("high", {
        sampleRate: 48e3,
        channelCount: 1,
        bitrate: 192
    }), NS.set("high-stereo", {
        sampleRate: 48e3,
        channelCount: 2,
        bitrate: 192
    });
    var MS, LS, VS, US = (xS = Mg.apply(void 0, S(Dg.LOCAL_STREAM.switchDevice)), b((OS = function (e) {
            u(LocalStream, e);
            var r, o, c, l, h, p, f, m = _(LocalStream);

            function LocalStream(e) {
                var n;
                a(this, LocalStream);
                var r = t(t({}, e), {
                    isRemote: !1,
                    type: "local"
                });
                return e.screen && (r.mirror = !1), (n = m.call(this, r)).name_ = Zs, n.video_ = e.video, n.audio_ = e.audio, n.cameraId_ = e.cameraId, n.cameraGroupId_ = "", n.facingMode_ = e.facingMode, n.microphoneId_ = e.microphoneId, n.microphoneGroupId_ = "", n.videoSource_ = e.videoSource, n.audioSource_ = e.audioSource, n.screen_ = e.screen, n.screenSource_ = e.screenSource, n.screenAudio_ = e.screenAudio, n.audioProfile_ = {
                    echoCancellation: !!Du(e.echoCancellation) || e.echoCancellation,
                    autoGainControl: !!Du(e.autoGainControl) || e.autoGainControl,
                    noiseSuppression: !!Du(e.noiseSuppression) || e.noiseSuppression,
                    sampleRate: 48e3,
                    channelCount: 1,
                    bitrate: 40
                }, n.videoProfile_ = {
                    width: 640,
                    height: 480,
                    frameRate: 15,
                    bitrate: 900
                }, n.screenProfile_ = {
                    width: 1920,
                    height: 1080,
                    frameRate: 5,
                    bitrate: 1600
                }, n.videoBitrate_ = n.screen_ ? 1600 : 900, n.videoSetting_ = null, n.mutedFlag_ = 0, n.beautyStatus_ = !1, n.recoverCaptureCount_ = 0, n.initState(), n.installEvents(), n.log_.debug("stream created: " + n.id_), n.canvas_ = null, n.canvasInterval_ = -1, n
            }
            return s(LocalStream, [{
                key: "initState",
                value: function () {
                    this.isAddingTrack_ = !1, this.isRemovingTrack_ = !1, this.setIsReadyToPublish(!1), this.setPublishState(qs)
                }
            }, {
                key: "installEvents",
                value: function () {
                    lg.on(hg.LOCAL_STREAM_PUBLISHED, this.onStreamPublished, this), lg.on(hg.VIDEO_TRACK_ENDED, this.onVideoTrackStopped, this), lg.on(hg.VIDEO_TRACK_MUTED, this.onVideoTrackStopped, this), lg.on(hg.AUDIO_TRACK_ENDED, this.onAudioTrackStopped, this), lg.on(hg.AUDIO_TRACK_MUTED, this.onAudioTrackStopped, this)
                }
            }, {
                key: "uninstallEvents",
                value: function () {
                    lg.off(hg.LOCAL_STREAM_PUBLISHED, this.onStreamPublished, this), lg.off(hg.VIDEO_TRACK_ENDED, this.onVideoTrackStopped, this), lg.off(hg.VIDEO_TRACK_MUTED, this.onVideoTrackStopped, this), lg.off(hg.AUDIO_TRACK_ENDED, this.onAudioTrackStopped, this), lg.off(hg.AUDIO_TRACK_MUTED, this.onAudioTrackStopped, this)
                }
            }, {
                key: "initialize",
                value: function () {
                    var e = this;
                    return new Promise((function (t, n) {
                        if (Av()) n(new ic({
                            code: rc.INVALID_OPERATION,
                            message: Z_({
                                key: j_
                            })
                        }));
                        else {
                            if (Du(e.audio_)) {
                                var r = new MediaStream;
                                return Du(e.audioSource_) || (r.addTrack(e.audioSource_), e.updateAudioPlayingState(!0)), Du(e.videoSource_) || (r.addTrack(e.videoSource_), e.updateVideoPlayingState(!0)), e.setMediaStream(r), ku({
                                    eventType: Ts,
                                    kind: "custom"
                                }), e.setIsReadyToPublish(!0), t()
                            }
                            e.screen_ ? (e.log_.info("initialize stream audio: " + e.audio_ + " screenAudio: " + e.screenAudio_ + " screen: " + e.screen_), CS({
                                audio: e.audio_,
                                screenAudio: e.screenAudio_,
                                microphoneId: e.microphoneId_,
                                screenSource: e.screenSource_,
                                width: e.screenProfile_.width,
                                height: e.screenProfile_.height,
                                frameRate: e.screenProfile_.frameRate,
                                sampleRate: e.audioProfile_.sampleRate,
                                channelCount: e.audioProfile_.channelCount,
                                autoGainControl: e.audioProfile_.autoGainControl,
                                noiseSuppression: e.audioProfile_.noiseSuppression,
                                echoCancellation: e.audioProfile_.echoCancellation
                            }).then((function (n) {
                                return e.setMediaStream(n), e.updateAudioPlayingState(e.audio_ || e.screenAudio_), e.updateVideoPlayingState(!0), e.listenForScreenSharingStopped(e.getVideoTrack()), e.setVideoContentHint("detail"), e.updateDeviceIdInUse(), e.setIsReadyToPublish(!0), ku({
                                    eventType: Ts,
                                    kind: "getDisplayMedia"
                                }), t()
                            })).catch((function (t) {
                                bu({
                                    eventType: Ts,
                                    kind: "getDisplayMedia",
                                    error: t
                                }), e.log_.error("getDisplayMedia error observed " + t), n(t)
                            }))) : (lg.emit(hg.LOCAL_STREAM_INITIALIZE_START, {
                                stream: e,
                                audio: e.audio_,
                                video: e.video_
                            }), e.log_.info("initialize stream audio: " + e.audio_ + " video: " + e.video_), RS({
                                audio: e.audio_,
                                video: e.video_,
                                facingMode: e.facingMode_,
                                cameraId: e.cameraId_,
                                microphoneId: e.microphoneId_,
                                width: e.videoProfile_.width,
                                height: e.videoProfile_.height,
                                frameRate: e.videoProfile_.frameRate,
                                sampleRate: e.audioProfile_.sampleRate,
                                channelCount: e.audioProfile_.channelCount,
                                autoGainControl: e.audioProfile_.autoGainControl,
                                noiseSuppression: e.audioProfile_.noiseSuppression,
                                echoCancellation: e.audioProfile_.echoCancellation
                            }).then((function (n) {
                                return lg.emit(hg.LOCAL_STREAM_INITIALIZE_END, {
                                    stream: e,
                                    audio: e.audio_,
                                    video: e.video_
                                }), "getSettings" in MediaStreamTrack.prototype && (e.videoSetting_ = n.getVideoTracks().length > 0 && n.getVideoTracks()[0].getSettings()), e.setMediaStream(n), e.updateAudioPlayingState(e.audio_), e.updateVideoPlayingState(e.video_), e.updateDeviceIdInUse(), e.log_.debug("gotStream hasAudio: " + e.hasAudio() + " hasVideo: " + e.hasVideo()), e.setIsReadyToPublish(!0), ku({
                                    eventType: Ts,
                                    kind: "getUserMedia"
                                }), t()
                            })).catch((function (t) {
                                lg.emit(hg.LOCAL_STREAM_INITIALIZE_FAILED, {
                                    stream: e,
                                    audio: e.audio_,
                                    video: e.video_,
                                    error: t
                                }), bu({
                                    eventType: Ts,
                                    kind: "getUserMedia",
                                    error: t
                                }), e.log_.error("getUserMedia error observed " + t), n(t)
                            })))
                        }
                    }))
                }
            }, {
                key: "listenForScreenSharingStopped",
                value: function (e) {
                    var t = this;
                    e.addEventListener("ended", (function (e) {
                        t.log_.info("screen sharing was stopped because the video track is ended"), t.emitter_.emit(ag)
                    }))
                }
            }, {
                key: "muteAudio",
                value: function () {
                    var e = v(d(LocalStream.prototype), "muteAudio", this).call(this);
                    return e && (this.log_.info("localStream mute audio"), this.sendMutedFlag(Fs, !0)), e
                }
            }, {
                key: "muteVideo",
                value: function () {
                    var e = v(d(LocalStream.prototype), "muteVideo", this).call(this);
                    return e && (this.log_.info("localStream mute video"), this.sendMutedFlag(js, !0)), e
                }
            }, {
                key: "unmuteAudio",
                value: function () {
                    var e = v(d(LocalStream.prototype), "unmuteAudio", this).call(this);
                    return e && (this.log_.info("localStream unmute audio"), this.sendMutedFlag(Fs, !1)), e
                }
            }, {
                key: "unmuteVideo",
                value: function () {
                    var e = v(d(LocalStream.prototype), "unmuteVideo", this).call(this);
                    return e && (this.log_.info("localStream unmute video"), this.sendMutedFlag(js, !1)), e
                }
            }, {
                key: "sendMutedFlag",
                value: function (e, t) {
                    this.setMutedFlag(e, t);
                    var n = this.getConnection();
                    if (n) {
                        n.sendMutedFlag(this.mutedFlag_);
                        var r = n.getUserId(),
                            i = n.getTinyId(),
                            a = "".concat(t ? "mute" : "unmute", " local ").concat(e, " track");
                        $f(r, {
                            eventId: e === Fs ? t ? Tf : bf : t ? kf : Rf,
                            eventDesc: a,
                            timestamp: mu(),
                            userId: r,
                            tinyId: i
                        })
                    }
                }
            }, {
                key: "setMutedFlag",
                value: function (e, t) {
                    e === Fs ? t ? this.mutedFlag_ |= 4 : this.mutedFlag_ &= -5 : t ? this.mutedFlag_ |= 1 : this.mutedFlag_ &= -2, this.log_.info("set ".concat(e, " muted state: [").concat(t ? "mute" : "unmute", "]"))
                }
            }, {
                key: "setAudioProfile",
                value: function (e) {
                    var r;
                    "object" === n(e) ? r = e : void 0 === (r = NS.get(e)) && (r = NS.get("standard")), this.log_.info("setAudioProfile: " + JSON.stringify(r)), this.audioProfile_ = t(t({}, this.audioProfile_), r)
                }
            }, {
                key: "setVideoProfile",
                value: (f = i(regeneratorRuntime.mark((function e(n) {
                    var r, i;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!this.connection_ || Cv()) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.NOT_SUPPORTED,
                                message: Z_({
                                    key: G_
                                })
                            });
                        case 2:
                            if (wu(n) ? r = t(t({}, this.videoProfile_), n) : xu(n) && (r = PS.get(n), Du(r) && (r = PS.get("480p"))), this.log_.info("setVideoProfile " + JSON.stringify(r)), !(i = this.getVideoTrack())) {
                                e.next = 8;
                                break
                            }
                            return e.next = 8, i.applyConstraints(r);
                        case 8:
                            if (this.videoBitrate_ === r.bitrate) {
                                e.next = 13;
                                break
                            }
                            if (!this.connection_) {
                                e.next = 12;
                                break
                            }
                            return e.next = 12, this.connection_.setBandwidth(r.bitrate, js);
                        case 12:
                            this.videoBitrate_ = r.bitrate;
                        case 13:
                            this.videoProfile_ = r;
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return f.apply(this, arguments)
                })
            }, {
                key: "getVideoBitrate",
                value: function () {
                    return this.videoBitrate_
                }
            }, {
                key: "getAudioBitrate",
                value: function () {
                    return this.audioProfile_.bitrate
                }
            }, {
                key: "setScreenProfile",
                value: function (e) {
                    var t = e;
                    "object" !== n(e) && void 0 === (t = DS.get(e)) && (t = DS.get("1080p")), this.log_.info("setScreenProfile " + JSON.stringify(e)), this.screenProfile_ = t, this.videoBitrate_ = t.bitrate
                }
            }, {
                key: "getVideoProfile",
                value: function () {
                    return this.screen_ ? this.screenProfile_ : this.videoProfile_
                }
            }, {
                key: "getAudioProfile",
                value: function () {
                    return this.audioProfile_
                }
            }, {
                key: "setVideoContentHint",
                value: function (e) {
                    var t = this.getVideoTrack();
                    t && "contentHint" in t && (this.log_.info("set video track contentHint to: " + e), t.contentHint = e, t.contentHint !== e && this.log_.warn("Invalid video track contentHint: " + e))
                }
            }, {
                key: "switchDevice",
                value: (p = i(regeneratorRuntime.mark((function e(t, n) {
                    var r, i, a, o, s, c, u, d, l, h, p, f, m, _, v, g, S;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!(r = t === Fs)) {
                                e.next = 8;
                                break
                            }
                            if (this.microphoneId_ !== n) {
                                e.next = 4;
                                break
                            }
                            return e.abrupt("return");
                        case 4:
                            this.microphoneId_ = n, this.audio_ = !0, e.next = 12;
                            break;
                        case 8:
                            if (this.cameraId_ !== n) {
                                e.next = 10;
                                break
                            }
                            return e.abrupt("return");
                        case 10:
                            n === Hs || n === Gs ? this.facingMode_ = n : this.cameraId_ = n, this.video_ = !0;
                        case 12:
                            if (this.getMediaStream()) {
                                e.next = 14;
                                break
                            }
                            return e.abrupt("return");
                        case 14:
                            return this.setIsReadyToPublish(!1), this.log_.info("switchDevice " + t + " to: " + n), r || ((i = this.getVideoTrack()) && i.stop(), Ad && (a = this.getAudioTrack()) && (this.log_.info("stop audio track first in huawei env"), a.stop())), r && (o = this.getAudioTrack(), s = this.getMicrophoneTrackMixed(), o && o.stop(), s && s.stop()), e.next = 20, RS({
                                audio: this.audio_ && t === Fs || Ad,
                                video: this.video_ && t === js,
                                facingMode: n === Hs || n === Gs ? n : void 0,
                                cameraId: this.cameraId_,
                                microphoneId: this.microphoneId_,
                                width: this.videoProfile_.width,
                                height: this.videoProfile_.height,
                                frameRate: this.videoProfile_.frameRate,
                                sampleRate: this.audioProfile_.sampleRate,
                                channelCount: this.audioProfile_.channelCount
                            });
                        case 20:
                            if (c = e.sent, u = null, !r) {
                                e.next = 27;
                                break
                            }(d = c.getAudioTracks()[0]) && this.isAudioTrackMixed() ? (l = this.getAudioTrack(), h = uy.AudioMixerPlugin.getAudioTrackMap(), p = HS.AudioMixerPlugin.mix({
                                targetTrack: d,
                                sourceList: h.get(l.id).sourceList,
                                trackList: h.get(l.id).trackList
                            }), u = p) : u = d, e.next = 33;
                            break;
                        case 27:
                            if ((u = c.getVideoTracks()[0]) && this.isVideoTrackBeautified() && (u = this.generateBeautyTrack(u)), !(f = c.getAudioTracks()[0]) || !Ad) {
                                e.next = 33;
                                break
                            }
                            return e.next = 33, this.replaceTrack_(f);
                        case 33:
                            return e.next = 35, this.replaceTrack_(u);
                        case 35:
                            this.updateDeviceIdInUse(), (m = this.getConnection()) && (_ = m.getUserId(), v = m.getTinyId(), g = wf, S = "switch camera", r && (g = Af, S = "switch microphone"), $f(_, {
                                eventId: g,
                                eventDesc: S,
                                timestamp: mu(),
                                userId: _,
                                tinyId: v
                            })), this.log_.info("switch ".concat(r ? "microphone" : "camera", " success ")), this.setIsReadyToPublish(!0);
                        case 40:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e, t) {
                    return p.apply(this, arguments)
                })
            }, {
                key: "addTrack",
                value: (h = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!this.isAddingTrack_) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: l_
                                })
                            });
                        case 2:
                            if (!this.isRemovingTrack_) {
                                e.next = 4;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: h_
                                })
                            });
                        case 4:
                            if (this.publishState_ !== Ks) {
                                e.next = 6;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: p_
                                })
                            });
                        case 6:
                            if (n = this.getMediaStream()) {
                                e.next = 9;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: f_
                                })
                            });
                        case 9:
                            if (!(t.kind === Fs && n.getAudioTracks().length > 0 || t.kind === js && n.getVideoTracks().length > 0)) {
                                e.next = 11;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: m_
                                })
                            });
                        case 11:
                            if (t.kind === js && "getSettings" in MediaStreamTrack.prototype && (r = t.getSettings(), !this.videoSetting_ || r.width === this.videoSetting_.width && r.height === this.videoSetting_.height || this.log_.warn("video resolution of the track (".concat(r.width, " x ").concat(r.height, ") shall be kept the same as the previous: ").concat(this.videoSetting_.width, " x ").concat(this.videoSetting_.height, ". It may cause abnormal Cloud Recording."))), e.prev = 12, this.isAddingTrack_ = !0, this.keepMuteState(t), !(i = this.getConnection())) {
                                e.next = 19;
                                break
                            }
                            return e.next = 19, i.addTrack(t);
                        case 19:
                            n.addTrack(t), t.kind === Fs ? (this.audio_ = !0, this.updateAudioPlayingState(!0)) : (this.video_ = !0, this.updateVideoPlayingState(!0)), this.isAddingTrack_ = !1, e.next = 28;
                            break;
                        case 24:
                            throw e.prev = 24, e.t0 = e.catch(12), this.isAddingTrack_ = !1, e.t0;
                        case 28:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [12, 24]
                    ])
                }))), function (e) {
                    return h.apply(this, arguments)
                })
            }, {
                key: "removeTrack",
                value: (l = i(regeneratorRuntime.mark((function e(t) {
                    var n, r;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (t.kind !== Fs) {
                                e.next = 2;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_PARAMETER,
                                message: Z_({
                                    key: __
                                })
                            });
                        case 2:
                            if (!this.isAddingTrack_) {
                                e.next = 4;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: v_
                                })
                            });
                        case 4:
                            if (!this.isRemovingTrack_) {
                                e.next = 6;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: g_
                                })
                            });
                        case 6:
                            if (this.publishState_ !== Ks) {
                                e.next = 8;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: S_
                                })
                            });
                        case 8:
                            if (n = this.getMediaStream()) {
                                e.next = 11;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: f_
                                })
                            });
                        case 11:
                            if (-1 !== n.getTracks().indexOf(t)) {
                                e.next = 13;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_PARAMETER,
                                message: Z_({
                                    key: y_
                                })
                            });
                        case 13:
                            if (1 !== n.getTracks().length) {
                                e.next = 15;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: T_
                                })
                            });
                        case 15:
                            if (e.prev = 15, this.isRemovingTrack_ = !0, !(r = this.getConnection())) {
                                e.next = 21;
                                break
                            }
                            return e.next = 21, r.removeTrack(t);
                        case 21:
                            n.removeTrack(t), t.kind === Fs ? (this.audio_ = !1, this.updateAudioPlayingState(!1)) : (this.video_ = !1, this.updateVideoPlayingState(!1)), this.isRemovingTrack_ = !1, e.next = 30;
                            break;
                        case 26:
                            throw e.prev = 26, e.t0 = e.catch(15), this.isRemovingTrack_ = !1, e.t0;
                        case 30:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [15, 26]
                    ])
                }))), function (e) {
                    return l.apply(this, arguments)
                })
            }, {
                key: "replaceTrack",
                value: (c = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (n = this.getMediaStream()) {
                                e.next = 3;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: d_
                                })
                            });
                        case 3:
                            if (this.publishState_ !== Ks) {
                                e.next = 5;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_OPERATION,
                                message: Z_({
                                    key: u_
                                })
                            });
                        case 5:
                            if (!(t.kind === Fs && n.getAudioTracks().length <= 0 || t.kind === js && n.getVideoTracks().length <= 0)) {
                                e.next = 7;
                                break
                            }
                            throw new ic({
                                code: rc.INVALID_PARAMETER,
                                message: Z_({
                                    key: k_,
                                    data: t
                                })
                            });
                        case 7:
                            if (t.kind === js && "getSettings" in MediaStreamTrack.prototype && (r = t.getSettings(), !this.videoSetting_ || r.width === this.videoSetting_.width && r.height === this.videoSetting_.height || this.log_.warn("video resolution of the track (".concat(r.width, " x ").concat(r.height, ") shall be kept the same as the previous: ").concat(this.videoSetting_.width, " x ").concat(this.videoSetting_.height, ". It may cause abnormal Cloud Recording."))), this.keepMuteState(t), t.kind === Fs ? (n.removeTrack(n.getAudioTracks()[0]), n.addTrack(t), v(d(LocalStream.prototype), "restartAudio", this).call(this)) : (n.removeTrack(n.getVideoTracks()[0]), n.addTrack(t), v(d(LocalStream.prototype), "restartVideo", this).call(this)), !(i = this.getConnection())) {
                                e.next = 14;
                                break
                            }
                            return e.next = 14, i.replaceTrack(t);
                        case 14:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return c.apply(this, arguments)
                })
            }, {
                key: "updateStream",
                value: (o = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a, o, s, c, u, d, l, h, p, f, m, _;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (this.mediaStream_) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return");
                        case 2:
                            return this.log_.info("updateStream() try to recover local stream"), e.prev = 3, e.next = 6, HS.getCameras();
                        case 6:
                            return n = e.sent, e.next = 9, HS.getMicrophones();
                        case 9:
                            if (r = e.sent, i = this.audio_ && t.audio, (a = this.video_ && t.video) && 0 === n.length && (a = !1, this.log_.info("updateStream() video flag is true, but no camera detected, set video to false")), i && 0 === r.length && (i = !1, this.log_.info("updateStream() audio flag is true, but no microphone detected, set audio to false")), !1 !== i || !1 !== a) {
                                e.next = 17;
                                break
                            }
                            return this.log_.info("updateStream() both audio and video are false, recover stream aborted"), e.abrupt("return");
                        case 17:
                            return o = t && n.findIndex((function (e) {
                                return e.deviceId === t.cameraId
                            })) >= 0, s = t && r.findIndex((function (e) {
                                return e.deviceId === t.microphoneId
                            })) >= 0, e.next = 21, RS({
                                audio: i,
                                video: a,
                                cameraId: o ? t.cameraId : void 0,
                                microphoneId: s ? t.microphoneId : void 0,
                                facingMode: this.facingMode_,
                                width: this.videoProfile_.width,
                                height: this.videoProfile_.height,
                                frameRate: this.videoProfile_.frameRate,
                                sampleRate: this.audioProfile_.sampleRate,
                                channelCount: this.audioProfile_.channelCount
                            });
                        case 21:
                            c = e.sent, u = c.getTracks(), d = 0;
                        case 24:
                            if (!(d < u.length)) {
                                e.next = 47;
                                break
                            }
                            if ((l = u[d]).kind !== Fs || !this.isAudioTrackMixed()) {
                                e.next = 37;
                                break
                            }
                            if (h = this.getAudioTrack(), p = HS.AudioMixerPlugin.getAudioTrackMap(), (f = p.get(h.id)).hasMicrophone) {
                                e.next = 33;
                                break
                            }
                            return l.stop(), e.abrupt("continue", 44);
                        case 33:
                            return m = HS.AudioMixerPlugin.mix({
                                targetTrack: l,
                                sourceList: f.sourceList,
                                trackList: f.trackList
                            }), e.next = 36, this.replaceTrack_(m);
                        case 36:
                            return e.abrupt("continue", 44);
                        case 37:
                            if (l.kind !== js || !this.isVideoTrackBeautified()) {
                                e.next = 42;
                                break
                            }
                            return _ = this.generateBeautyTrack(l), e.next = 41, this.replaceTrack_(_);
                        case 41:
                            return e.abrupt("continue", 44);
                        case 42:
                            return e.next = 44, this.replaceTrack_(l);
                        case 44:
                            d++, e.next = 24;
                            break;
                        case 47:
                            this.updateDeviceIdInUse(), ku({
                                eventType: Rs
                            }), this.log_.info("updateStream() recover local stream successfully"), e.next = 57;
                            break;
                        case 52:
                            e.prev = 52, e.t0 = e.catch(3), bu({
                                eventType: Rs,
                                error: e.t0
                            }), this.log_.error("updateStream() failed to recover local stream, " + e.t0), this.emitter_.emit(sg, new ic({
                                code: rc.DEVICE_AUTO_RECOVER_FAILED,
                                message: e.t0.message
                            }));
                        case 57:
                        case "end":
                            return e.stop()
                        }
                    }), e, this, [
                        [3, 52]
                    ])
                }))), function (e) {
                    return o.apply(this, arguments)
                })
            }, {
                key: "replaceTrack_",
                value: (r = i(regeneratorRuntime.mark((function e(t) {
                    var n, r, i, a;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (n = this.mediaStream_.getAudioTracks(), r = this.mediaStream_.getVideoTracks(), !(t.kind === Fs && n.length <= 0 || t.kind === js && r.length <= 0)) {
                                e.next = 5;
                                break
                            }
                            return this.log_.info("there is no previous ".concat(t.kind, " track, replacement ignored")), e.abrupt("return");
                        case 5:
                            if (this.keepMuteState(t), t.kind === Fs ? (this.mediaStream_.removeTrack(n[0]), this.mediaStream_.addTrack(t), v(d(LocalStream.prototype), "restartAudio", this).call(this)) : ("getSettings" in MediaStreamTrack.prototype && (i = t.getSettings(), !this.videoSetting_ || i.width === this.videoSetting_.width && i.height === this.videoSetting_.height || this.log_.warn("the resolution of video track to be replaced (".concat(i.width, " x ").concat(i.height, ") is different from the previous video settings (").concat(this.videoSetting_.width, " x ").concat(this.videoSetting_.height, "). It may cause a cloud recording exception"))), this.mediaStream_.removeTrack(r[0]), this.mediaStream_.addTrack(t), v(d(LocalStream.prototype), "restartVideo", this).call(this)), !(a = this.getConnection())) {
                                e.next = 11;
                                break
                            }
                            return e.next = 11, a.replaceTrack(t);
                        case 11:
                        case "end":
                            return e.stop()
                        }
                    }), e, this)
                }))), function (e) {
                    return r.apply(this, arguments)
                })
            }, {
                key: "updateDeviceIdInUse",
                value: function () {
                    var e = this;
                    if (!this.mediaStream_) return this.cameraId_ = "", this.cameraGroupId_ = "", this.microphoneId_ = "", void(this.microphoneGroupId_ = "");
                    "getSettings" in MediaStreamTrack.prototype && this.mediaStream_.getTracks().forEach((function (t) {
                        if (t.kind === Fs && e.isAudioTrackMixed()) {
                            var n = e.getMicrophoneTrackMixed();
                            if (n) {
                                var r = n.getSettings(),
                                    i = r.deviceId,
                                    a = r.groupId;
                                i && (e.microphoneId_ = i, e.microphoneGroupId_ = a)
                            }
                        } else if (t.kind === js && e.isVideoTrackBeautified()) {
                            var o = e.getBeautyOriginTrack();
                            if (o) {
                                var s = o.getSettings(),
                                    c = s.deviceId,
                                    u = s.groupId;
                                c && (e.cameraId_ = c, e.cameraGroupId_ = u)
                            }
                        } else {
                            var d = t.getSettings(),
                                l = d.deviceId,
                                h = d.groupId;
                            l && (t.kind === Fs ? (e.microphoneId_ = l, e.microphoneGroupId_ = h) : t.kind !== js || e.screen_ || (e.cameraId_ = l, e.cameraGroupId_ = h))
                        }
                    }));
                    var t = this.mediaStream_.getAudioTracks(),
                        n = this.mediaStream_.getVideoTracks();
                    t && 0 === t.length && (this.microphoneId_ = "", this.microphoneGroupId_ = ""), n && 0 === n.length && (this.cameraId_ = "", this.cameraGroupId_ = "")
                }
            }, {
                key: "isAudioTrackMixed",
                value: function () {
                    if (HS.AudioMixerPlugin) {
                        var e = HS.AudioMixerPlugin.getAudioTrackMap(),
                            t = this.getAudioTrack();
                        if (e && t && e.has(t.id)) return !0
                    }
                    return !1
                }
            }, {
                key: "getMicrophoneTrackMixed",
                value: function () {
                    if (HS.AudioMixerPlugin) {
                        var e = HS.AudioMixerPlugin.getAudioTrackMap(),
                            t = this.getAudioTrack();
                        if (e && t && e.has(t.id)) {
                            var n = e.get(t.id);
                            return n.hasMicrophone ? n.microphoneTrack : null
                        }
                    }
                    return null
                }
            }, {
                key: "isVideoTrackBeautified",
                value: function () {
                    if (HS.beautyTrackMap) {
                        var e = HS.beautyTrackMap,
                            t = this.getVideoTrack();
                        if (t && e.has(t.id)) return !0
                    }
                    return !1
                }
            }, {
                key: "getBeautyOriginTrack",
                value: function () {
                    if (HS.beautyTrackMap) {
                        var e = HS.beautyTrackMap,
                            t = this.getVideoTrack();
                        if (t && e.has(t.id)) {
                            var n = e.get(t.id);
                            if (n.originTrack) return n.originTrack
                        }
                    }
                    return null
                }
            }, {
                key: "generateBeautyTrack",
                value: function (e) {
                    var t = this.getVideoTrack(),
                        n = HS.beautyTrackMap.get(t.id).pluginInstance.generateBeautyTrack(e);
                    return this.log_.info("regenerate beauty track, track id = ".concat(e.id)), n
                }
            }, {
                key: "getScreen",
                value: function () {
                    return this.screen_
                }
            }, {
                key: "hasScreenTrack",
                value: function () {
                    if (this.screen_) return !0;
                    var e = this.getVideoTrack();
                    return !!e && ("detail" === e.contentHint || "text" === e.contentHint)
                }
            }, {
                key: "getVideo",
                value: function () {
                    return this.video_
                }
            }, {
                key: "getAudio",
                value: function () {
                    return this.audio_
                }
            }, {
                key: "getCameraId",
                value: function () {
                    return this.cameraId_
                }
            }, {
                key: "getMicrophoneId",
                value: function () {
                    return this.microphoneId_
                }
            }, {
                key: "getMicrophoneGroupId",
                value: function () {
                    return this.microphoneGroupId_
                }
            }, {
                key: "getIsReadyToPublish",
                value: function () {
                    return this.isReadyToPublish_
                }
            }, {
                key: "setIsReadyToPublish",
                value: function (e) {
                    this.isReadyToPublish_ = e
                }
            }, {
                key: "setPublishState",
                value: function (e) {
                    this.publishState_ = e
                }
            }, {
                key: "setBeautyStatus",
                value: function (e) {
                    this.beautyStatus_ = !!e
                }
            }, {
                key: "getBeautyStatus",
                value: function () {
                    return this.beautyStatus_
                }
            }, {
                key: "onStreamPublished",
                value: function (e) {
                    if (e.localStream === this) {
                        var t = this.getAudioTrack(),
                            n = this.getVideoTrack();
                        if (t) {
                            var r = !t.enabled;
                            this.setMutedFlag(Fs, r)
                        }
                        if (n) {
                            var i = !n.enabled;
                            this.setMutedFlag(js, i)
                        }
                        this.connection_ && this.connection_.sendMutedFlag(this.mutedFlag_)
                    }
                }
            }, {
                key: "keepMuteState",
                value: function (e) {
                    e instanceof MediaStreamTrack && this.mutedFlag_ & (e.kind === js ? 1 : 4) && (e.enabled = !1, this.log_.warn("prev ".concat(e.kind, " track is muted, keep mute state")))
                }
            }, {
                key: "onVideoTrackStopped",
                value: function (e) {
                    var t = e.stream,
                        n = e.type;
                    t !== this || !this.video_ || !this.cameraId_ || this.recoverCaptureCount_ > 10 || qu && "mute" === n || (this.recoverCaptureCount_ += 1, Su("stat-local-video-".concat(n)), this.updateStream({
                        audio: !1,
                        video: !0,
                        cameraId: this.cameraId_
                    }))
                }
            }, {
                key: "onAudioTrackStopped",
                value: function (e) {
                    var t = e.stream,
                        n = e.type;
                    t !== this || !this.audio_ || !this.microphoneId_ || this.recoverCaptureCount_ > 10 || (this.recoverCaptureCount_ += 1, Su("stat-local-audio-".concat(n)), this.updateStream({
                        audio: !0,
                        video: !1,
                        microphoneId: this.microphoneId_
                    }))
                }
            }, {
                key: "setAudioVolume",
                value: function (e) {
                    v(d(LocalStream.prototype), "setAudioVolume", this).call(this, e)
                }
            }, {
                key: "close",
                value: function () {
                    v(d(LocalStream.prototype), "close", this).call(this), this.uninstallEvents()
                }
            }, {
                key: "clearCanvas",
                value: function () {
                    this.canvasInterval_ && (Tl.clearInterval(this.canvasInterval_), this.canvasInterval_ = -1, this.canvas_ = null)
                }
            }, {
                key: "genCanvasTrack",
                value: function (e) {
                    var t = this;
                    this.log_.info("gen canvas track");
                    var n = e.getSettings(),
                        r = n.width,
                        i = n.height,
                        a = n.frameRate;
                    this.canvas_ = document.createElement("canvas");
                    var o = this.canvas_.getContext("2d");
                    return this.canvas_.width = r, this.canvas_.height = i, this.canvasInterval_ = Tl.setInterval((function () {
                        if (t.hasVideo()) {
                            var e = t.getVideoTrack().getSettings();
                            e.width === t.canvas_.width && e.height === t.canvas_.height || (t.canvas_.width = e.width, t.canvas_.height = e.height)
                        }
                        t.videoPlayer_ && t.videoPlayer_.element_ && o.drawImage(t.videoPlayer_.element_, 0, 0, t.canvas_.width, t.canvas_.height)
                    }), Math.max(66, Math.floor(1e3 / a))), this.canvas_.captureStream().getVideoTracks()[0]
                }
            }]), LocalStream
        }(Ug)).prototype, "switchDevice", [xS], Object.getOwnPropertyDescriptor(OS.prototype, "switchDevice"), OS.prototype), OS),
        FS = 0,
        jS = 0,
        BS = (MS = Ng(Dg.TRTC.createClient), LS = Ng(Dg.TRTC.createStream), b((VS = function () {
            function e() {
                a(this, e), this.name_ = Ys, this.VERSION = "4.11.8", this.Logger = {
                    LogLevel: {
                        TRACE: 0,
                        DEBUG: 1,
                        INFO: 2,
                        WARN: 3,
                        ERROR: 4,
                        NONE: 5
                    },
                    setLogLevel: function (e) {
                        Kd.setLogLevel(e), "zh" === (navigator.language || navigator.userLanguage).substr(0, 2) && e <= 1 && $_()
                    }, enableUploadLog: function () {
                        Kd.enableUploadLog()
                    }, disableUploadLog: function () {
                        Kd.disableUploadLog()
                    }
                }
            }
            var n, r, o, c, u;
            return s(e, [{
                key: "checkSystemRequirements",
                value: (u = i(regeneratorRuntime.mark((function e() {
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            return e.next = 2, kv();
                        case 2:
                            return e.abrupt("return", e.sent);
                        case 3:
                        case "end":
                            return e.stop()
                        }
                    }), e)
                }))), function () {
                    return u.apply(this, arguments)
                })
            }, {
                key: "isScreenShareSupported",
                value: function () {
                    return bv()
                }
            }, {
                key: "isSmallStreamSupported",
                value: function () {
                    return Lv()
                }
            }, {
                key: "getDevices",
                value: (c = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!Av() && !wv()) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return", []);
                        case 2:
                            return e.next = 4, navigator.mediaDevices.enumerateDevices();
                        case 4:
                            return t = e.sent, e.abrupt("return", t.map((function (e, t) {
                                var n = e.label;
                                e.label || (n = e.kind + "_" + t);
                                var r = {
                                    label: n,
                                    deviceId: e.deviceId,
                                    kind: e.kind
                                };
                                return e.groupId && (r.groupId = e.groupId), r
                            })));
                        case 6:
                        case "end":
                            return e.stop()
                        }
                    }), e)
                }))), function () {
                    return c.apply(this, arguments)
                })
            }, {
                key: "getCameras",
                value: (o = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!Av() && !wv()) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return", []);
                        case 2:
                            return e.next = 4, navigator.mediaDevices.enumerateDevices();
                        case 4:
                            return t = e.sent, e.abrupt("return", t.filter((function (e) {
                                return "videoinput" === e.kind
                            })).map((function (e, t) {
                                var n = e.label;
                                e.label || (n = "camera_" + t);
                                var r = {
                                    label: n,
                                    deviceId: e.deviceId,
                                    kind: e.kind
                                };
                                return e.groupId && (r.groupId = e.groupId), r
                            })));
                        case 6:
                        case "end":
                            return e.stop()
                        }
                    }), e)
                }))), function () {
                    return o.apply(this, arguments)
                })
            }, {
                key: "getMicrophones",
                value: (r = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!Av() && !wv()) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return", []);
                        case 2:
                            return e.next = 4, navigator.mediaDevices.enumerateDevices();
                        case 4:
                            return t = e.sent, e.abrupt("return", t.filter((function (e) {
                                return "audioinput" === e.kind
                            })).map((function (e, t) {
                                var n = e.label;
                                e.label || (n = "microphone_" + t);
                                var r = {
                                    label: n,
                                    deviceId: e.deviceId,
                                    kind: e.kind
                                };
                                return e.groupId && (r.groupId = e.groupId), r
                            })));
                        case 6:
                        case "end":
                            return e.stop()
                        }
                    }), e)
                }))), function () {
                    return r.apply(this, arguments)
                })
            }, {
                key: "getSpeakers",
                value: (n = i(regeneratorRuntime.mark((function e() {
                    var t;
                    return regeneratorRuntime.wrap((function (e) {
                        for (;;) switch (e.prev = e.next) {
                        case 0:
                            if (!Av() && !wv()) {
                                e.next = 2;
                                break
                            }
                            return e.abrupt("return", []);
                        case 2:
                            return e.next = 4, navigator.mediaDevices.enumerateDevices();
                        case 4:
                            return t = e.sent, e.abrupt("return", t.filter((function (e) {
                                return "audiooutput" === e.kind
                            })).map((function (e, t) {
                                var n = e.label;
                                e.label || (n = "speaker_" + t);
                                var r = {
                                    label: n,
                                    deviceId: e.deviceId,
                                    kind: e.kind
                                };
                                return e.groupId && (r.groupId = e.groupId), r
                            })));
                        case 6:
                        case "end":
                            return e.stop()
                        }
                    }), e)
                }))), function () {
                    return n.apply(this, arguments)
                })
            }, {
                key: "createClient",
                value: function (e) {
                    Hl && (Hl = !1, Kd.getLogLevel() != HS.Logger.LogLevel.NONE && (console.info("******************************************************************************"), console.info("*   欢迎使用 TRTC Web SDK - 腾讯云实时音视频通信"), console.info("*   API 文档：https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/index.html"), console.info("*   版本更新日志：https://cloud.tencent.com/document/product/647/38958"), console.info("*   反馈问题：https://github.com/tencentyun/TRTCSDK/issues"), console.info("******************************************************************************")), Kd.info("TRTC Web SDK Version: 4.11.8"), Kd.info("UserAgent: " + navigator.userAgent), Kd.info("URL of current page: " + location.href));
                    var n = {
                        version: this.VERSION
                    };
                    return new bS(t(t(t({}, n), e), {}, {
                        seq: ++FS
                    }))
                }
            }, {
                key: "createStream",
                value: function (e) {
                    return new US(t(t({}, e), {}, {
                        seq: ++jS
                    }))
                }
            }]), e
        }()).prototype, "createClient", [MS], Object.getOwnPropertyDescriptor(VS.prototype, "createClient"), VS.prototype), b(VS.prototype, "createStream", [LS], Object.getOwnPropertyDescriptor(VS.prototype, "createStream"), VS.prototype), VS);
    Av();
    var HS = new BS;
    return HS
}));